Ask Your Question

inverse filter c++

asked 2016-12-31 11:47:13 -0500


I want to implement the Inverse filter which is basically F=G/ F is the restored image, G is the blurred image and H is the kernel that blurred the image after transformed by DFT.

But there are a lot of thing that I don not know how to do it like : -I don't know how to handle the complex output from the forward DFT and how two divide two spectrums G and H to obtain F.

-Which flags to use in the forward DFT and in the Inverse DFT


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-31 12:04:26 -0500

Tetragramm gravatar image

Forward, no flag. Inverse, DFT_INVERSE and DFT_SCALE.

Documentation on all the flags is HERE.

You'll have to write divSpectrums yourself. Take a look at the mulSpectrums function to get an idea, and look up how to divide complex numbers to get the details.

edit flag offensive delete link more


Thanks for you response how to have a look at the mulSpectrums function's code?

ibrahimovic gravatar imageibrahimovic ( 2016-12-31 12:30:42 -0500 )edit

Oops, I take it back, divSpectrums exists, you just have to make it exportable.

Tetragramm gravatar imageTetragramm ( 2016-12-31 12:51:27 -0500 )edit

what do you mean by making it exportable ?how could I do that Sorry for my lack of knowledge ?

ibrahimovic gravatar imageibrahimovic ( 2016-12-31 13:22:54 -0500 )edit

You'll need to compile OpenCV for yourself, and make some changes. Once you get OpenCV compiling as-is (see the tutorials if you need them), then you need to modify the include file to declare the function, like THIS line.

The important parts are the CV_EXPORTS_W, which tells the compiler that the function should be able to be accessed outside the dll, and that the declaration is in the include file, so your program can see it.

Tetragramm gravatar imageTetragramm ( 2016-12-31 14:01:52 -0500 )edit

Question Tools

1 follower


Asked: 2016-12-31 11:47:13 -0500

Seen: 907 times

Last updated: Dec 31 '16