Summary of the invention
The purpose of the present invention is to provide a kind of discrete Kalman's self-adapting image denoising system based on FPGA, make
Valence is lower, and image processing speed is fast, performance with higher and lower energy consumption, can satisfy design complexity and in real time
Property, complexity when hardware design is reduced, has the advantages that operation is easy, is applied widely.
In order to achieve the above objectives, solution of the invention is:
A kind of discrete Kalman's self-adapting image denoising system based on FPGA, including based on FPGA processor construct from
Dissipate Kalman filtering module, image data input module, data memory module, clock frequency division module and data outputting module, figure
As data input module is by the image pixel data of acquisition deposit data memory module, clock frequency division module realizes timing control
System is carried out after Kalman Filtering for Discrete module carries out noise reduction process to the image in data memory module by data outputting module
Image output.
The course of work of above-mentioned image data input module is: the image for wanting noise reduction read in by MATLAB, and
Image pixel information is generated as .mif formatted file, image data is stored by the memory ROM module in FPGA later.
The course of work of above-mentioned clock frequency division module is: frequency dividing setting is carried out to externally input clock, for data
It is periodically read, and carries out the recursive calculation of discrete Kalman according to the period.
Above-mentioned Kalman filtering module includes filter module and kalman gain calculates and filtering parameter modified module.
Above-mentioned data outputting module task is using the serial communication between FPGA and computer, by Kalman Filtering for Discrete module
Filtered image data is sent to computer, and generates .txt file;Then MATLAB program is utilized, by the figure in txt file
As data are read out, to generate filtered image result.
The present invention will carry out the Algorithm mapping of image denoising based on the end PC to FPGA hardware platform using Kalman model,
The high speed processing for realizing image noise reduction process, to improve the computational efficiency of image denoising;FPGA does not use operating system, institute
The problem of mutually occupying to obtain risk not have task, avoiding some stability aspects, and its requirement to external environment
Nor very high.
After adopting the above scheme, the invention has the advantages that:
(1) it since FPGA has the characteristics that parallel processing, is greatly improved for the processing speed of service of algorithm, this
Two ROM memory modules are had invoked to FPGA in design, a module stores the pixel data of image, another ROM module
The parameters such as the gain, the estimated value that generate when then storing Kalman filtering module arithmetic, this more improves arithmetic speed;
(2) real-time pipeline operation can be carried out based on FPGA, realizes the processing operation of multitask, can reach highest real-time
Property, when being filtered noise reduction to dynamic image, it can be identified in real time, read in data and carry out calculation process, this will
Greatly improve the efficiency of work;
(3) high speed processing of image noise reduction process is realized by the design, and this system hardware itself has simply
Structure also has versatility, while the internal logic circuit by changing FPGA, energy for the otherwise processing of image
Realize the processing requirement different based on Kalman filtering algorithm, this makes Kalman's image noise reduction system based on FPGA, is locating
Reason aspect has greater flexibility, is with a wide range of applications.
Specific embodiment
Below with reference to attached drawing, technical solution of the present invention and beneficial effect are described in detail.
As shown in Figure 1, the present invention provides a kind of discrete Kalman's self-adapting image denoising system based on FPGA, including base
It is protected in the Kalman Filtering for Discrete module of FPGA processing construction, the image data input module of image information collecting, sample image
The data that image is called after the clock frequency division module and noise reduction of the data memory module, the use of internal system timing control deposited
Output module is introduced separately below.
The main task of FPGA processor is to make FPGA under the control of timing by designing suitable timing, to having given birth to
At image pixel data deposit ROM module in;The image pixel information for being stored in register module is adjusted again later
It is passed to Kalman filtering module with reading, and by data, Kalman filtering processing is carried out, exports filtered data, finally
Picture after showing filtering noise reduction on computers.
Described image data input module is mainly based upon the filtering noise reduction that main direction of studying of the present invention is image, figure
Picture data are fixed value in the calculation process stage, therefore in terms of the acquisition of image data, directly read image slices using FPGA
The mode of the data such as element.Specific method is to be read in by MATLAB to the image for wanting noise reduction, and image pixel information is given birth to
As .mif formatted file, image data is stored by the memory ROM module in the module of the ready-made offer of FPGA later.Due to
Depth, the bit wide of ROM module etc. are restricted, so in mif paper formulation it is noted that the size to image is adjusted, so that
When FPGA handles image later, the reading of data will not be caused to lack because data are overflowed, to reduce
The effect of filtering processing;Later again by FPGA to the calling of ROM module, the extraction of data is carried out.When reading data,
FPGA each period will be updated once, so that data be allowed successively to flow out one by one, carry out the processing of next step in filter module
Operation.When storing pixel, the information such as parameter according to the size of image pixel data so that it is determined that register number number, such as
The .mif file that MATLAB shown in Fig. 2 is generated, the image that the present embodiment selection is filtered is gray level image, pixel data bits
8 (due to being gray level image, it is not absolutely required to 16 data), tonal range is 0-255, and image size is
260*195, data are shown as hexadecimal.And Fig. 3 is shown image data in FPGA, number is image pixel in figure
Binary representation, since requirement to data is generally binary form when handling data in FPGA, therefore here shown as two
Binary form.When program later reads data, then the reading of data, such as first number are carried out from first address of addr
According to being 1100000000, it is passed to filter module and carries out the processing of data.Then after next cycle starts, the is read
Pixel value in two addresses, then carry out operation.And after all data have been read, pointer can then be directed toward first again
A address.
The clock frequency division module main task is to carry out frequency dividing setting to externally input clock, so as to obtain
Clock required for AD control conversion module and Kalman filtering module in FPGA system.This project adopts image pixel value
Collect the mode directly read, and AD conversion module is not used, so the clock that frequency dividing obtains then is used to carry out periodically data
Reading, and carry out according to the period recursive calculation of discrete Kalman.
The Kalman filtering module, the as design of Kalman filter are in whole image noise reduction process module
Center portion point.The module is broadly divided into filter module and kalman gain calculates and filtering parameter modified module.Kalman filter
Design core be 5 filtering equations in filtering algorithm.It is addition subtraction multiplication and division arithmetic used in filtering equations, but same
When be not only plus and minus calculation directly carried out to data, but the value of parameter and each register is carried out to be converted to floating number, be become
For the addition subtraction multiplication and division operation to floating number, so filter module mainly has adder, multiplier, divider here.It is being transported
Related data is put into being further processed for the pending datas such as register after calculation, the filter module emulation element figure is as shown in Figure 4.
Input clock in Fig. 4, outside clk expression;Reset is system reset input;In is indicated from ROM module to card
The data output of Kalman Filtering module, but it is also the input port of the original digital image data of Kalman filtering module;Randn table
Show random number series, since number is random distribution, therefore the noise signal information instead of image can be used to;True is used to table
Show the true value of image data after noise is added, value can be expressed as true=randn+in;Ob is the measured value of module;
Out is that the final optimal estimated value of filter module and final data export result.
Also, as shown in Figure 4, the digit of output port is different, causes such the reason is that Kalman in order to prevent
Optimal estimation value generates overflow error.The digit of estimated value can make arithmetic speed reduce too much, and digit will make very little
The digit of optimal estimation value generates spilling more than setting digit, so that error is generated, so that filter effect is deteriorated.So estimation
The digit of value will take a suitable value.Data can be reduced to multiple appropriate here, so that last output valve will not produce
It is raw to overflow.And in FPGA, the mode of diminution is to move to left the binary representation number of data, and zero padding.It will in the present embodiment
Data reduce 8 times, move to left 3 according to binary representation, cause digit three more, therefore the delivery outlet digit of out and true
Setting is three more, is [0:10].
Fig. 5 be Kalman filtering flow chart, in FPGA program first to each port, operation when using the parameters arrived into
Row definition statement, includes for data input port, the statement of clock input port, the statement and data of each register port here
The definition of output port is stated.Since image data is deposited in ROM module, each period once calls ROM, reads
One of data carry out next filtering operation, therefore the number of recursive operation is arranged according to this, so that being deposited in ROM
In all image datas outflow, and Kalman filtering module carry out calculation processing.Recurrence number is judged, when
When recurrence number is lower than setting value, then calculation processing is filtered;If being higher than setting value, illustrate that image data is all passed through
At this moment calculation process terminates operation, and carry out the data output step of next step.By using quartus and modelsim etc.
Simulation software carries out simulating, verifying to Kalman filtering module, obtains modular simulation timing diagram, as shown in Figure 6.
The period it will be set as 100ps in the present embodiment, it can be seen from time stimulatiom figure as 100ps, rising edge clock
Triggering, Kalman filtering module are started to work, while the port the in periodically called data from ROM, and carry out the reading of data
It takes, first numerical value is 11000000, identical as the data that first address in .mif file is stored.The port true output simultaneously
After the actual value for the Randn for serving as noise is added, indicate that the image data after noise is added, ob port is that output filter is surveyed
Amount adds the image data value after making an uproar, and the port out outputs and exporting Kalman's optimal estimation value after filtering processing, that is, locates
Data value after reason.It can reflect out from figure, due to it joined random noise after, the value of measurement changes, and represents and adds
Noise information is entered.And after filtering, data change compared with the value that noise is added, and illustrate to be filtered.
The data outputting module task mainly after data carry out calculation process by Kalman filtering module, utilizes FPGA
Filtered image data is sent to computer, and generates .txt file by the serial communication between computer.Finally utilize
Image data in txt file is read out by MATLAB program, to generate filtered image result.As shown in fig. 7,
Serial port protocol starts the start bit triggered for low level, controls communication of the data between hardware and computer.Eight are number later
According to position, the data type of typical hardware calculation process is binary system, and eight bit data here is also binary type.Even-odd check
Position be for transmission data carry out error detection, this project data transmission do not need using.It is finally stop bit, represents number
According to transmission terminate.
Here the main start bit of the transmission of data and the periodically variable level triggers of stop bit control data transmission, often
A transmission period eight bit data is sent to computer terminal port by FPGA.Later by serial ports transmitting software to the image pixel value shape of transmission
File is read out at txt file, then by MATLAB program, image is ultimately formed and is shown, as shown in Figure 8.
In conclusion a kind of discrete Kalman's self-adapting image denoising system based on FPGA of the present invention, practicability is high, excellent
Point protrusion compensates for the domestic disadvantage not high in image noise reduction field computational efficiency now, and this system hardware itself has letter
Single structure also has versatility for the otherwise processing of image, passes through simultaneously without carrying out a large amount of cable wiring manufacture
The internal logic circuit for changing FPGA, can be achieved with the processing requirement different based on Kalman filtering algorithm, this to be based on
Kalman's image noise reduction system of FPGA has greater flexibility and feasibility in terms of processing, has a wide range of applications valence
Value.
The above described is only a preferred embodiment of the present invention, be not intended to limit the present invention in any form, though
So the present invention has been disclosed as a preferred embodiment, and however, it is not intended to limit the invention, any technology people for being familiar with this profession
Member, without departing from the scope of the present invention, when the technology contents using the disclosure above are modified or are modified
For the equivalent embodiment of equivalent variations, but anything that does not depart from the technical scheme of the invention content, according to the technical essence of the invention
Any simple modification, equivalent change and modification to the above embodiments, still falls within the range of technical solution of the present invention
It is interior.