Ask Your Question
0

inverse filter c++

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

Hello,

I want to implement the Inverse filter which is basically F=G/H.here 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

BEST

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

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

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

Comments

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

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

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

https://github.com/opencv/opencv/blob/master/modules/imgproc/src/phasecorr.cpp#L157

Tetragramm gravatar imageTetragramm ( 2016-12-31 12:51:27 -0600 )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 -0600 )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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,154 times

Last updated: Dec 31 '16