Summary of the invention
It is an object of the invention to provide a kind of real time image processing, it is possible to complete HDR technology in real time
Realization on FPGA, optimizes HDR algorithm, synthesizes high-definition picture in real time, reduces power consumption,
Improve video frame number.
The technical solution adopted in the present invention is: a kind of real time image processing, including:
The respective pixel data of each images different for light exposure in the video of source are write different buffer area, and same
Step reads that each buffer area light exposure is different but pixel data that position is identical;
The pixel data of reading is reduced to pixel light intensity values, described pixel light intensity values is synthesized HDR picture
Element.
Further, described real time image processing also includes:
Described HDR pixel is carried out tone mapping process.
Optionally, described by the respective pixel data write difference of each images different for light exposure in the video of source
Buffer area, and synchronize to read each buffer area light exposure is different but pixel data that position is identical includes: will not
N number of different buffer area is write, when described N number of buffer area all writes picture with the respective pixel data of image
Prime number according to time, use N number of read command to read the pixel data of described N number of buffer area, and use 1
Write order write ith pixel data, described read and write commands uses polling mode to carry out;Wherein,
N is exposure encirclement group quantity, and i is presently written pixel data, and it is slow that ith pixel data are write
Deposit district to determine according to the light exposure of described ith pixel data.
Optionally, described the pixel data of reading is reduced to pixel light intensity values, by described pixel light intensity values
Synthesis HDR pixel includes: according to default lookup table, the N number of pixel data read is reduced to pixel
Light intensity value, synthesizes HDR pixel by weighting function by described N number of pixel light intensity values.
Optionally, described the pixel data of reading is reduced to pixel light intensity values, by described pixel light intensity values
Synthesis HDR pixel includes: pass through formula
Synthesis HDR pixel, wherein:
For HDR pixel, x represents pixel position on exposure image;fiX () is that i-th exposes
Pixel value at x position in light image;F(fi(x)) it is that the light intensity with pixel value as corresponding address is searched
Form;W(fi(x)) it is the weight lookup table with pixel value as corresponding address.
Further,
Described light intensity lookup table is: F (fi(x))=w (fi(x))kif-1(fi(x));
Described weight lookup table is: W (fi(x))=w (fi(x)),
Wherein:
f-1X () is the inverse function of video capture device response curve;
w(fi(x)) it is the weighting function of respective pixel;
kiFor the exposure compensating of each pixel, the k of adjacent exposure imageiEqual.
Further, described described HDR pixel is carried out tone mapping process include: according to default ginseng
Several be compressed HDR pixel processes.
Optionally, described according to parameter preset, HDR pixel be compressed process and include:
Pass through formula:It is compressed HDR pixel processing,
Wherein:
QiFor the pixel value after compression;
HDR pixel for synthesis;
R, k and d are the parameter for regulating contrast and brightness.
Further, after being compressed processing to HDR pixel according to parameter preset, also include: to pressure
Described HDR pixel on after contracting carries out process of convolution;Described convolution processing result is for compressed
Video carries out edge enhancement.
Further, described real time image processing also includes: the HDR pixel after processing mapping
Carry out white balance to control and histogram process, and export on display.
The real time image processing that the present invention provides: identical with source video exposure encirclement group number by arranging
Buffer area, and control the read-write at each buffer area of the respective pixel data, it is achieved synchronize to read light exposure phase
Same pixel data, ensures that the pixel data read is identical with the pixel data frame number of source video simultaneously.Logical
Cross lookup table to the reduction of light exposure same pixel data and synthesis, complete HDR technology in real time and exist
Realization on FPGA.Compared to prior art, it is possible to reduce the operand of HDR algorithm, close in real time
Become high-definition image, reduce power consumption, improve video frame number.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the present invention, the technical scheme in the present invention is carried out clearly and completely
Describe, it is clear that described embodiment is a part of embodiment of the present invention rather than whole embodiment.
Based on the embodiment in the present invention, those of ordinary skill in the art are not making the premise of creative work
Lower obtained every other embodiment broadly falls into the scope of protection of the invention.
The real time image processing that the present invention provides, it is possible to complete HDR technology in real time on FPGA
Realization.As it is shown in figure 1, this real time image processing includes:
101, source video is obtained.
Wherein, the described source each frame of video is made up of the image of Same Scene difference light exposure, and number is surrounded in exposure
Amount can regulate according to actual needs.Especially by controlling sensor, it is achieved video each frame cycle alternation in source exposes
Light.In the video of source, each exposure of every frame arranges and alternately changes with video capture device (such as camera) frame number.
Such as, camera frame number is 60 frames/second, then the exposure of the every frame of source video arranges 1/60 second and changes once.Phase
The exposure difference of adjacent frame is identical, and surrounding quantity by exposure is 3 and as a example by exposure interval quantity is 2, according to time
Between order, the light exposure of first image is 2 times of second image exposure amount, second image exposure
Amount is 2 times of the 3rd image exposure amount.And the exposure of the 4th image arranges identical with first, as
It it is circulation.
102, the respective pixel data of each images different for light exposure in the video of source are write different buffer area,
And synchronize to read each buffer area light exposure is different but pixel data that position is identical.
Concrete, the respective pixel data of each images different for light exposure in the video of source are write N number of difference
Buffer area, when described N number of buffer area equal writing pixel data, uses N number of read command to read described N
The pixel data of individual buffer area, and use 1 write order write ith pixel data, described reading and
Writing commands uses polling mode to carry out.Wherein, N is exposure encirclement group quantity, and i is presently written
Pixel data, buffer area corresponding to ith pixel data determines according to the light exposure of ith pixel data.
Respective number of pixels refers to the pixel data of same coordinate position, described poll in the image that each exposure is different
Mode refers to that the write according to pixel data and reading high-speed circulating are carried out.
As a example by Fig. 2, exposure encirclement group quantity is 3,3 buffer areas 201,202 and 203 are set.
In certain period, source video comprises certain five two field picture 20,21,22,23 and 24, image 20 and 23
Light exposure is identical, and 21 is identical with 24 light exposures, 3 image respective number of pixels of the first exposure encirclement group
According to 3 image respective pixel data 21,22 and 23 of 20,21 and 22, second exposure encirclement groups,
3 image respective pixel data 22,23 and 24 of the 3rd exposure encirclement group.When receiving source video figure
As each pixel data of 20, it is written into buffer area 201 corresponding address;When receiving source video figure
As each pixel data of 21, it is written into buffer area 202 corresponding address;Buffer area 201 data are not
Become;When receiving each pixel data of source video image 22, it is written into buffer area 203 accordingly
Location, buffer area 201,202 data are constant.When receiving each pixel data of source video image 23,
Because the light exposure of image 23 is identical with image 20, so updating buffer area 201, i.e. use pixel data
23 cover pixel data 20.Now, 3 buffer area equal writing pixel data, updating buffer area 201
While, poll reads each pixel data of 3 buffer area images 23,21 and 22;Due to caching
District's number is identical with source video exposure encirclement group number, it is ensured that the view data of reading and the picture number of source video
Identical according to frame number.
When receiving source video pixel data 24, update 202,3 equal writing pixels of buffer area of buffer area
Data, read the pixel data 23,24 and 22 of 3 buffer areas with polling mode;From each buffer area
The video image read each contain corresponding single exposure, follow-up the like, repeat no more.
103, the pixel data of reading is reduced to pixel light intensity values, described pixel light intensity values is synthesized HDR
Pixel.
Concrete, according to default lookup table, the N number of pixel data read is reduced to pixel light intensity values,
By weighting function, described N number of pixel light intensity values is synthesized HDR pixel.Wherein, lookup table is permissible
It is configured according to sensor light majorant, weight function selection Gaussian function.Preferably, can preset
Two lookup table, preset lookup table according to said two and the N number of pixel data read are reduced to picture
Two numerical value are carried out division operation by element light intensity value and corresponding weighted value.
Optionally, the pixel data of reading can be reduced to pixel light intensity values and by picture by equation below
Element light intensity value synthesis HDR pixel.
Wherein:
For the light intensity value close to true environment sensed on HDR pixel, i.e. sensor, x table
Show pixel position on exposure image;
fiX () is the pixel value in i-th exposure image at x position;
F(fi(x)) it is the light intensity lookup table with pixel value as corresponding address;
W(fi(x)) it is the weight lookup table with pixel value as corresponding address.
Preferably, light intensity lookup table is: F (fi(x))=w (fi(x))kif-1(fi(x));
Weight lookup table is: W (fi(x))=w (fi(x));
Wherein: f-1(fi(x)) it is the inverse function of the response curve of video capture device (such as camera);
w(fi(x)) it is the weighting function of respective pixel;
kiFor the exposure compensating of each pixel, the k of adjacent exposure imageiEqual.
Optionally, w (fi(x)) weighting function can determine according to the synthetic effect needed for user.Generally
In the case of, w (fi(x)) weighting function can by regulation Gaussian function obtain, such as, w (fi(x)) by height
This function defines, adjusted according to corresponding exposure by location parameter μ and σ, then w (fi(x))
Weighting function is represented by equation below:
In the case of extreme path shines, the image exposed containing high (or extremely low) may select S sigmoid growth curve
(sigmoid function) is as weighting function.Such as, too high (scene that brightness is extremely low) is set when exposure
Or when exposure arranges too low (scene that brightness is high), w (fi(x)) can be selected for S sigmoid growth curve,
Regulated accordingly according to corresponding exposure by location parameter v, then w (fi(x)) weighting function can table
It is shown as equation below:
It should be noted that difference can be selected according to practical situation concrete weight selection function when
Gaussian function or S sigmoid growth curve, it is also possible to selecting other functions to be adjusted, above-mentioned formula is only
It is the example of weight selection function, is not intended that limitation of the invention.
104, described HDR pixel is carried out tone mapping process.
Concrete, it being compressed processing to HDR pixel according to parameter preset, described compression processes can lead to
Cross equation below to realize:
Wherein:
QiFor the pixel value after compression;
HDR pixel for synthesis;
R, k and d are the parameter for regulating contrast and brightness, realize contrast by regulating r, k and d simultaneously
Degree and the regulation of brightness.
After being processed by above-mentioned compression, video image can be made at limited dynamic range medium, show as common
Show and preliminarily show on device.Further, the HDR image after above-mentioned compression is carried out at convolution
Reason, generates each layer and obscures pixel for extracting the details of original image, in order to generate contrast in mapping process
Spend big profile.
Concrete, preferred dimension be the binary system Gaussian matrix of S × S as template to the figure after above-mentioned compression
As carrying out two-dimensional discrete process of convolution.Formula is as follows:
Wherein:
(x, is y) that in image, corresponding line number is x after process of convolution to F, and columns is the pixel value of y;
(x, is y) that in pending image, corresponding line number is x to I, and columns is the pixel value of y;
S is odd number, as a example by 5 × 5,The i.e. radius of this discrete matrix;
(x, y) is binary system Gaussian matrix template to V, can be with more in shorter time by shift operation
Few calculating cost obtains result.This matrix template numerical value everywhere is the n times power of 2.In convolution algorithm,
All multipliers are reduced to left shift operation.Matrix norm as a example by the matrix template of 5 × 5, after normalization
Plate is as follows:
Pixel is obscured by the iterative convolution computing the most continuously of same sub-picture can be generated each layer.Repeatedly
Depending on generation number can be according to calculating cost.Generate each layer and obscure the pixel edge enhancement for original image.Show
Example, edge enhancement can be realized by equation below:
Wherein:
(x, is y) that in image, corresponding line number is x before and after edge enhancement to I, and columns is the pixel value of y;
(x, is y) that in image, corresponding line number is x after edge enhancement to I ', and columns is the pixel value of y;
cnFor the respective default weighted value of n-layer detail pictures;
Fn((x y) is n interative computation of above-mentioned convolution algorithm to I.
105, the HDR pixel after described tone mapping being processed shows
Concrete, by analyzing each exposure section of source video, the image after tone mapping processes is carried out
White balance controls and histogram processes, and exports on display.
The real time image processing that the present invention provides: identical with source video exposure encirclement group number by arranging
Buffer area, and control the read-write at each buffer area of the respective pixel data, it is achieved synchronize to read light exposure not
With but the identical pixel data in position, ensure the frame of pixel data of pixel data and the source video read simultaneously
Number is identical.By the synthesis of light exposure same pixel data is mapped with tone, complete HDR technology
Realization on FPGA.Compared to prior art, optimize the algorithm of HDR technology and by its Hardware,
Synthesize high-definition picture in real time, while improving frame per second, reduce power consumption.
The present invention also provides for a kind of image processing circuit, and such as Fig. 3, this circuit includes the caching being sequentially connected with
Circuit module 31, combiner circuit module 32, mapping circuit module 33 and display control circuit module 34.
Buffer circuit module 31 is connected with video source, is used for receiving source video image, by light exposure in the video of source
The different buffer area of respective pixel data write of different each images, and synchronize to read each buffer area light exposure
The pixel data that different but position is identical.Combiner circuit module 32, for the pixel data reduction that will read
For pixel light intensity values, described pixel light intensity values is synthesized HDR pixel.Mapping circuit module 33 is used for will
Described HDR pixel carries out tone mapping process.Display control circuit module 34 is connected with external display,
HDR pixel after described tone mapping being processed shows.
Such as Fig. 4, buffer circuit module 31 includes N number of video interface 310, each video interface 310
Connect the read-write controller 311 having correspondence, all read-write controllers 311 and polling system module 312 phase
Even, polling system module 312 is connected with internal memory 313.Wherein, N number of video interface 310 is used respectively
In receiving the respective pixel data of different images in source video same encirclement group, N is that source video exposure is surrounded
Group quantity;Read-write controller 311 is write to internal memory 313 from coupled video interface 310 for control
Enter and/or read pixel data, when N number of internal memory 313 equal writing pixel data, using N number of reading to order
The pixel data of N number of internal memory 313 is read in order, and uses 1 write order write ith pixel data,
I is the pixel data of presently written internal memory 313;Polling system module 312 is used for controlling each read-write control
The read write command of device 311 processed, uses endless form to internal memory 313 high speed writein and/or to read pixel data.
Combiner circuit module 32 includes lookup table module and the arithmetical unit being sequentially connected with.Lookup table mould
Block prestores N number of first lookup table and N number of second of connection corresponding with N number of video interface 310 and looks into
Looking for form, described first lookup table is for being reduced to N number of pixel light by the N number of pixel data read
Intensity values, described second look-up table lattice are for being reduced to N number of weighted value by the N number of pixel data read;
Described arithmetical unit, for synthesizing HDR pixel by described pixel light intensity values and described weighted value.Further
, include adder and divider arithmetical unit.
As a example by Fig. 5, combiner circuit module 32 includes the first lookup table module 320, second look-up table
Lattice module 320 ', and two adders 321 of connection corresponding with the two respectively, two add device 321 with
Divider 322 is connected.Pixel data fiX () processes through the first lookup table module 320 and is reduced to pixel light
Intensity values FiX (), processes through second look-up table lattice module 320 ' and is reduced to weighted value Wi(x), Fi(x) and Wi(x)
Synthesizing HDR pixel through two adders 321 respectively, two HDR pixel remove through divider 322
Computing obtains final HDR pixel q (x).Exemplary, the first lookup table module 320 may be configured as
F(fi(x))=w (fi(x))kif-1(fi(x));Second look-up table lattice module 320 ' may be configured as
W(fi(x))=w (fi(x)).Wherein: f-1(fi(x)) it is the inverse function of video capture device response curve;
w(fi(x)) it is the weighting function of respective pixel;kiExposure compensating for each pixel.
Such as Fig. 6, mapping circuit module 33 includes the compression module 330 being sequentially connected with, the first color conversion
Module 331, convolution module 332, the second color conversion module 333.Compression module 330 and combiner circuit
The outfan of module 32 is connected, for being compressed processing by HDR pixel q (x) according to parameter preset.
Specifically can pass through formulaIt is compressed HDR pixel processing, wherein: QiFor
Pixel value after compression;HDR pixel for synthesis;R, k and d are for regulating contrast and brightness
Parameter.First color conversion module 331 is for being converted to the color value of HDR pixel from RGB
YCrCb;Convolution module 332 obscures pixel for generating each layer extracting original image details, in order to reflecting
The profile that contrast is big is generated during penetrating.Convolution module 332 includes the row cache module that head and the tail connect,
Convolution algorithm module and edge enhancement module, row cache module and edge enhancement module and the first color conversion
Module 331 is connected, and edge enhancement module is connected with the second color conversion module 333, the second color conversion
Module 333 is for being converted to RGB by the color value of HDR pixel from YCrCb.Exemplary, choosing
As template, the image after compression is carried out two-dimensional discrete volume by the binary system Gaussian matrix of a size of S × S
Long-pending process.Convolution algorithm module can realize its function by equation below:
Wherein:
(x, is y) that in image, corresponding line number is x after process of convolution to F, and columns is the pixel value of y;
(x, is y) that in pending image, corresponding line number is x to I, and columns is the pixel value of y;
S is odd number, as a example by 5 × 5,The i.e. radius of this discrete matrix;
(x, y) is binary system Gaussian matrix template to V, can be with more in shorter time by shift operation
Few calculating cost obtains result.This matrix template numerical value everywhere is the n times power of 2.In convolution algorithm,
All multipliers are reduced to left shift operation.Matrix norm as a example by the matrix template of 5 × 5, after normalization
Plate is as follows:
Pixel is obscured by the iterative convolution computing the most continuously of same sub-picture can be generated each layer.Repeatedly
Depending on generation number can be according to calculating cost.Generate each layer and obscure the pixel edge enhancement for original image.Show
Example, edge enhancement module can realize its function by equation below:
Wherein:
(x, is y) that in image, corresponding line number is x before and after edge enhancement to I, and columns is the pixel value of y;
(x, is y) that in image, corresponding line number is x after edge enhancement to I ', and columns is the pixel value of y;
cnFor the respective default weighted value of n-layer detail pictures;
Fn((x y) is n interative computation of above-mentioned convolution algorithm to I.In conjunction with Fig. 3~6, show control circuit
Module 34 is connected with each video interface 310 and the second color conversion module 333, is used for analyzing source and regards
Frequently each exposure section, the HDR pixel after tone mapping processes carries out white balance control and rectangular histogram
Homogenization Treatments, and export on display.
The image processing circuit that the present invention provides, exposes with source video by arranging in buffer circuit module
The cache module that encirclement group number is identical, and control the read-write at each cache module of the respective pixel data, it is achieved
Synchronize to read light exposure is different but pixel data that position is identical, ensure pixel data and the source read simultaneously
The pixel data frame number of video is identical.By the synthesis to light exposure same pixel data of the combiner circuit module
And the tone mapping of mapping circuit module processes, complete the realization on FPGA of the HDR technology.
Compared to prior art, optimize the algorithm of HDR technology and by its Hardware, synthesize high-resolution in real time
Image, reduces power consumption while improving frame per second.
Finally illustrate: various embodiments above is only in order to illustrate technical scheme, rather than to it
Limit;Although the present invention being described in detail with reference to foregoing embodiments, the common skill of this area
Art personnel it is understood that the technical scheme described in foregoing embodiments still can be modified by it,
Or the most some or all of technical characteristic is carried out equivalent;And these amendments or replacement, and
The essence not making appropriate technical solution departs from the scope of embodiment of the present invention technical scheme.