Invention content
The object of the present invention is to provide a kind of real time image processings, can complete HDR technologies in real time on FPGA
It realizes, optimizes HDR algorithms, synthesize high-definition picture in real time, reduce power consumption, improve video frame number.
The technical solution adopted in the present invention is:A kind of real time image processing, including:
Different buffer areas are written into the respective pixel data of the different each image of light exposure in source video, and synchronous reading is each
Buffer area light exposure difference but the identical pixel data in position;
The pixel data of reading is reduced to pixel light intensity value, the pixel light intensity value is synthesized into HDR pixel.
Further, the real time image processing further includes:
The HDR pixel is subjected to tone mapping processing.
Optionally, different buffer areas are written in the respective pixel data of each image that light exposure in source video is different,
And synchronization reads each buffer area light exposure difference but the identical pixel data in position includes:By the respective pixel data of different images
N number of different buffer area is written, when the equal writing pixel data of the N number of buffer area, is read using N number of read command described N number of slow
The pixel data in area is deposited, and ith pixel data are written using 1 write order, the read and write commands use poll side
Formula carries out;Wherein, N is exposure encirclement group quantity, and i is presently written pixel data, the caching that ith pixel data are written
Area is determined according to the light exposure of the ith pixel data.
Optionally, described that the pixel data of reading is reduced to pixel light intensity value, the pixel light intensity value is synthesized into HDR pictures
Element includes:N number of pixel data of reading is reduced to pixel light intensity value according to default lookup table, it will be described by weighting function
N number of pixel light intensity value synthesizes HDR pixel.
Optionally, described that the pixel data of reading is reduced to pixel light intensity value, the pixel light intensity value is synthesized into HDR pictures
Element includes:Pass through formula
HDR pixel is synthesized, wherein:
For HDR pixel, x indicates position of the pixel on exposure image;fi(x) it is x position in i-th of exposure image
The pixel value at place;F(fi(x)) it is using pixel value as the luminous intensity lookup table of corresponding address;W(fi(x)) it with pixel value is pair to be
Answer the weight lookup table of address.
Further,
The luminous intensity lookup table is:F(fi(x))=w (fi(x))kif-1(fi(x));
The weight lookup table is:W(fi(x))=w (fi(x)),
Wherein:
f-1(x) it 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 imageiIt is equal.
Further, described to include by HDR pixel progress tone mapping processing:According to parameter preset to HDR pixel
Carry out compression processing.
Optionally, described to include to HDR pixel progress compression processing according to parameter preset:
Pass through formula:Compression processing is carried out to HDR pixel,
Wherein:
QiFor compressed pixel value;
For the HDR pixel of synthesis;
R, k and d are the parameter for adjusting comparison and brightness.
Further, after carrying out compression processing to HDR pixel according to parameter preset, further include:Described on after compression
HDR pixel carries out process of convolution;The convolution processing result is used to carry out edge enhancement to compressed video.
Further, the real time image processing further includes:White balance control is carried out to mapping treated HDR pixel
System and histogram processing, and be output on display.
Real time image processing provided by the invention:Pass through setting caching identical with source video exposure encirclement group number
Area, and read-write of the respective pixel data in each buffer area is controlled, it realizes to synchronize and reads the identical pixel data of light exposure, protect simultaneously
It is identical as the pixel data frame number of source video to demonstrate,prove the pixel data read.By searching for table to light exposure same pixel data
Reduction and synthesis, complete realization of the HDR technologies on FPGA in real time.Compared to the prior art, the fortune of HDR algorithms can be reduced
Calculation amount synthesizes high-definition image in real time, reduces power consumption, improves video frame number.
Specific implementation mode
Below in conjunction with the attached drawing in the present invention, the technical solution in the present invention is clearly and completely described, is shown
So, the embodiment described is a part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiments of the present invention,
The every other embodiment that those of ordinary skill in the art are obtained without making creative work belongs to this
Invent the range of protection.
Real time image processing provided by the invention can complete realization of the HDR technologies on FPGA in real time.Such as Fig. 1
Shown, which includes:
101, source video is obtained.
Wherein, each frame of the source video is made of the image of Same Scene difference light exposure, and quantity is surrounded in exposure can basis
Actual needs is adjusted.Especially by control sensor, each frame cycle alternation exposure of source video is realized.Each of per frame in source video
Exposure is arranged with video capture device (such as camera) frame number alternate change.For example, camera frame number is 60 frames/second, then source video is every
The exposure of frame is arranged 1/60 second and changes once.The exposure difference of consecutive frame is identical, and it is 3 and exposure interval quantity to surround quantity with exposure
It is for 2, according to time sequencing, the light exposure of first image is 2 times of second image exposure amount, second image exposure
Amount is 2 times of third image exposure amount.And the exposure setting of the 4th image is identical with first, recycles in this way.
102, different buffer areas, and synchronous reading is written into the respective pixel data of the different each image of light exposure in source video
Go out each buffer area light exposure difference but the identical pixel data in position.
Specifically, by the N number of different buffer areas of the respective pixel data write-in of the different each image of light exposure in source video, when
When the equal writing pixel data of N number of buffer area, the pixel data of N number of buffer area is read using N number of read command, and use
Ith pixel data are written in 1 write order, and the read and write commands are carried out using polling mode.Wherein, N is exposure packet
Enclose a group quantity, i is presently written pixel data, and the corresponding buffer area of ith pixel data is according to the exposures of ith pixel data
Light quantity determines.Respective number of pixels refers to the pixel data of same coordinate position in the different image of each exposure, the poll side
Formula refers to being carried out according to the write-in and reading high-speed circulating of pixel data.
For exposing encirclement group quantity in Fig. 2 and be 3,3 buffer areas 201,202 and 203 are set.In certain time, source
Video includes certain five frame image 20,21,22,23 and 24, and image 20 is identical with 23 light exposures, and 21 is identical with 24 light exposures, and first
Expose 3 image respective pixel data 20,21 and 22 of encirclement group, 3 image respective pixel data of the second exposure encirclement group
21,22 and 23, third exposes 3 image respective pixel data 22,23 and 24 of encirclement group.When receiving source video image 20
Each pixel data is written into 201 corresponding address of buffer area;It, will when each pixel data for receiving source video image 21
202 corresponding address of buffer area is written in it;201 data of buffer area are constant;When each pixel data for receiving source video image 22,
It is written into 203 corresponding address of buffer area, buffer area 201,202 data are constant.When each picture for receiving source video image 23
Prime number evidence updates buffer area 201 because the light exposure of image 23 is identical as image 20, that is, uses pixel data 23 to cover picture
Prime number is according to 20.At this point, the equal writing pixel data of 3 buffer areas, while updating buffer area 201, poll reads 3 buffer areas
Each pixel data of image 23,21 and 22;Since buffer area number is identical as source video exposure encirclement group number, ensure reading
Image data is identical as the image data frame number of source video.
When receiving source video pixel data 24,202,3 equal writing pixel data of buffer area of buffer area are updated, with poll
Mode reads the pixel data 23,24 and 22 of 3 buffer areas;The video image read from each buffer area respectively contains corresponding
Single exposure, follow-up and so on, it repeats no more.
103, the pixel data of reading is reduced to pixel light intensity value, the pixel light intensity value is synthesized into HDR pixel.
Specifically, N number of pixel data of reading is reduced to pixel light intensity value according to default lookup table, pass through weight letter
N number of pixel light intensity value is synthesized HDR pixel by number.Wherein, lookup table can be configured according to sensor light majorant,
Weight function selection Gaussian function.Preferably, two lookup tables can be preset, will be read according to described two default lookup tables
The N number of pixel data taken is reduced to pixel light intensity value and corresponding weighted value, and two values are carried out division operation.
Optionally, by following formula the pixel data of reading can be reduced to pixel light intensity value and by pixel light intensity value
Synthesize HDR pixel.
Wherein:
For HDR pixel, i.e., the light intensity value close to true environment sensed on sensor, x indicates that pixel is exposing
Position on image;
fi(x) it is the pixel value at x position in i-th of exposure image;
F(fi(x)) it is using pixel value as the luminous intensity lookup table of corresponding address;
W(fi(x)) it is using pixel value as the weight lookup table of corresponding address.
Preferably, luminous 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 imageiIt is equal.
Optionally, w (fi(x)) weighting function can be determined according to the synthetic effect needed for user.Under normal conditions, w (fi
(x)) weighting function can be obtained by adjusting Gaussian function, for example, w (fi(x)) it is defined by Gaussian function, passes through location parameter μ
With σ according to corresponding exposure adjusted, then w (fi(x)) weighting function is represented by following formula:
It is shone in extreme path, S sigmoid growth curve (sigmoid letters may be selected in the image containing high (or extremely low) exposure
Number) it is used as weighting function.For example, when excessively high (the extremely low scene of brightness) or exposure setting is arranged in exposure, too low (brightness is high
Scene) when, w (fi(x)) S sigmoid growth curves can be selected, accordingly adjusted according to corresponding exposure by location parameter v
It saves, then w (fi(x)) weighting function is represented by following formula:
It should be noted that different Gaussian functions can be selected according to actual conditions when specific weight selection function
Number or S sigmoid growth curves, can also select other functions to be adjusted, and above-mentioned formula is only the example of weight selection function,
Do not constitute limitation of the invention.
104, the HDR pixel is subjected to tone mapping processing.
Specifically, carrying out compression processing to HDR pixel according to parameter preset, the compression processing can pass through following formula reality
It is existing:
Wherein:
QiFor compressed pixel value;
For the HDR pixel of synthesis;
R, k and d are the parameter for adjusting contrast and brightness, and contrast and brightness are realized by adjusting r, k and d simultaneously
Adjusting.
After above-mentioned compression processing, video image can be made in limited dynamic range medium, as at the beginning of in regular display
Show to step.Further, process of convolution is carried out to above-mentioned compressed HDR image, generates the fuzzy pixel of each layer and is used for
The details for extracting original image, to generate the big profile of contrast in mapping process.
Specifically, the binary system Gaussian matrix that preferred dimension is S × S carries out two as template to above-mentioned compressed image
Tie up discrete convolution processing.Formula is as follows:
Wherein:
F (x, y) is x to correspond to line number in the image after process of convolution, and columns is the pixel value of y;
I (x, y) is x to correspond to line number in pending image, and columns is the pixel value of y;
S is odd number, for 5 × 5,That is the radius of the discrete matrix;
V (x, y) is binary system Gaussian matrix template, can be calculated as with less in shorter time by shift operation
Originally result is obtained.The matrix template n times power that numerical value is 2 everywhere.In convolution algorithm, all multipliers are reduced to fortune of shifting left
It calculates.By taking 5 × 5 matrix template as an example, the matrix template after normalization is as follows:
By the way that same sub-picture, repeatedly continuously iterative convolution operation can generate the fuzzy pixel of each layer.Iterations can
Depending on calculating cost.It generates each layer and obscures the edge enhancement that pixel is used for original image.Illustratively, edge enhancement can pass through
Following formula is realized:
Wherein:
I (x, y) is that correspond to line number before and after edge enhancement in image be x, and columns is the pixel value of y;
I ' (x, y) is that correspond to line number after edge enhancement in image be x, and columns is the pixel value of y;
cnFor the respective default weighted value of n-layer detail pictures;
Fn(I (x, y) is the n times interative computation of above-mentioned convolution algorithm.
105, by the tone mapping, treated that HDR pixel is shown
Specifically, by analyzing each exposure section of source video, white balance control is carried out on tone mapping treated image
System and histogram processing, and be output on display.
Real time image processing provided by the invention:Pass through setting caching identical with source video exposure encirclement group number
Area, and read-write of the respective pixel data in each buffer area is controlled, realize synchronous reading light exposure difference but the identical pixel in position
Data, while ensureing that the pixel data read is identical as the pixel data frame number of source video.By to light exposure same pixel number
According to synthesis and tone mapping, complete realization of the HDR technologies on FPGA.Compared to the prior art, optimize the calculation of HDR technologies
Method and by its Hardware, synthesizes high-definition picture, reduces power consumption while improving frame per second in real time.
The present invention also provides a kind of image processing circuit, such as Fig. 3, which includes sequentially connected buffer circuit module
31, combiner circuit module 32, mapping circuit module 33 and display control circuit module 34.Buffer circuit module 31 and video source phase
Even, for receiving source video image, different cachings are written into the respective pixel data of the different each image of light exposure in source video
Area, and each buffer area light exposure difference of synchronous reading but the identical pixel data in position.Combiner circuit module 32, for that will read
Pixel data be reduced to pixel light intensity value, by the pixel light intensity value synthesize HDR pixel.Mapping circuit module 33 is used for institute
It states HDR pixel and carries out tone mapping processing.Display control circuit module 34 is connected with external display, for reflecting the tone
Penetrating treated, HDR pixel is shown.
Such as Fig. 4, buffer circuit module 31 includes N number of video interface 310, and each video interface 310 is connected with corresponding reading
Writing controller 311, all read-write controllers 311 are connected with polling system module 312, polling system module 312 and 313 phase of memory
Even.Wherein, N number of video interface 310 is respectively used to receive the respective pixel data of different images in the same encirclement group of source video, N
It is source video exposure encirclement group quantity;Read-write controller 311 is for controlling from coupled video interface 310 to memory 313
Write-in and/or reading pixel data read N number of memory when 313 equal writing pixel data of N number of memory using N number of read command
313 pixel data, and ith pixel data are written using 1 write order, i is the pixel data of presently written memory 313;
Polling system module 312 is used to control the read write command of each read-write controller 311, using endless form to 313 high speed of memory
Write-in and/or reading pixel data.
Combiner circuit module 32 includes sequentially connected lookup table module and arithmetic unit.Lookup table module prestore with
N number of first lookup table and N number of second look-up table lattice that N number of video interface 310 is correspondingly connected with, first lookup table are used for
N number of pixel data of reading is reduced to N number of pixel light intensity value, N number of pixel number that the second look-up table lattice are used to read
According to being reduced to N number of weighted value;The arithmetic unit, for the pixel light intensity value and the weighted value to be synthesized HDR pixel.Into one
Step, arithmetic unit includes adder and divider.
By taking Fig. 5 as an example, combiner circuit module 32 include the first lookup table module 320, second look-up table lattice module 320 ',
And two adders 321 being correspondingly connected with respectively with the two, two add device 321 to be connected with divider 322.Pixel data fi
(x) it is handled through the first lookup table module 320 and is reduced to pixel light intensity value Fi(x), it is handled through second look-up table lattice module 320 '
It is reduced to weighted value Wi(x), Fi(x) and Wi(x) HDR pixel is synthesized through two adders 321 respectively, two HDR pixels are through division
Device 322 carries out division operation and obtains final HDR pixel q (x).Illustratively, 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;kiIt is each
The exposure compensating of pixel.
Such as Fig. 6, mapping circuit module 33 includes sequentially connected compression module 330, the first color conversion module 331, volume
Volume module 332, the second color conversion module 333.Compression module 330 is connected with the output end of combiner circuit module 32, is used for root
HDR pixel q (x) is subjected to compression processing according to parameter preset.Formula can specifically be passed throughTo HDR pixel
Compression processing is carried out, wherein:QiFor compressed pixel value;For the HDR pixel of synthesis;R, k and d be for adjust comparison and
The parameter of brightness.First color conversion module 331 is used to the color value of HDR pixel being converted to YCrCb from RGB;Convolution module
332 obscure pixel for generating each layer of extraction original image details, to generate the big profile of contrast in mapping process.Volume
Volume module 332 includes the row cache module of head and the tail connection, convolution algorithm module and edge enhancement module, row cache module and profile
Enhancing module is connected with the first color conversion module 331, and edge enhancement module is connected with the second color conversion module 333, and second
Color conversion module 333 is used to the color value of HDR pixel being converted to RGB from YCrCb.Illustratively, preferred dimension is S × S
Binary system Gaussian matrix as template to compressed image carry out two-dimensional discrete process of convolution.Convolution algorithm module can pass through
Following formula realizes its function:
Wherein:
F (x, y) is x to correspond to line number in the image after process of convolution, and columns is the pixel value of y;
I (x, y) is x to correspond to line number in pending image, and columns is the pixel value of y;
S is odd number, for 5 × 5,That is the radius of the discrete matrix;
V (x, y) is binary system Gaussian matrix template, can be calculated as with less in shorter time by shift operation
Originally result is obtained.The matrix template n times power that numerical value is 2 everywhere.In convolution algorithm, all multipliers are reduced to fortune of shifting left
It calculates.By taking 5 × 5 matrix template as an example, the matrix template after normalization is as follows:
By the way that same sub-picture, repeatedly continuously iterative convolution operation can generate the fuzzy pixel of each layer.Iterations can
Depending on calculating cost.It generates each layer and obscures the edge enhancement that pixel is used for original image.Illustratively, edge enhancement module can
Its function is realized by following formula:
Wherein:
I (x, y) is that correspond to line number before and after edge enhancement in image be x, and columns is the pixel value of y;
I ' (x, y) is that correspond to line number after edge enhancement in image be x, and columns is the pixel value of y;
cnFor the respective default weighted value of n-layer detail pictures;
Fn(I (x, y) is the n times interative computation of above-mentioned convolution algorithm.In conjunction with Fig. 3~6, display control circuit module 34 with
Each video interface 310 and the second color conversion module 333 are connected, for analyzing each exposure section of source video, in tone mapping
White balance control and histogram processing are carried out on treated HDR pixel, and are output on display.
Image processing circuit provided by the invention exposes encirclement group number by being arranged in buffer circuit module with source video
Identical cache module, and control read-write of the respective pixel data in each cache module, realize it is synchronous read light exposure it is different but
The identical pixel data in position, while ensureing that the pixel data read is identical as the pixel data frame number of source video.Pass through synthesis
Circuit module handles the synthesis of light exposure same pixel data and the tone mapping of mapping circuit module, completes HDR skills
Realization of the art on FPGA.Compared to the prior art, optimize the algorithm of HDR technologies and by its Hardware, synthesize high-resolution in real time
Rate image reduces power consumption while improving frame per second.
What is finally illustrated is:The above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, it will be understood by those of ordinary skill in the art that:It is still
Either which part or all technical features can be carried out so that technical scheme described in the above embodiments is modified
Equivalent replacement;And these modifications or replacements, technical solution of the embodiment of the present invention that it does not separate the essence of the corresponding technical solution
Range.