2016-03-18 16:29:15 -0600 | received badge | ● Teacher (source) |
2013-04-15 08:46:56 -0600 | received badge | ● Self-Learner (source) |
2013-04-15 08:34:17 -0600 | answered a question | OpenCV gpu::dft distorted image after inverse transform It took me several more hours but I have eventually solved the problem. There are two options 1) real-to-complex (CV_32FC1 -> CV_32FC2) forward and complex-to-real (CV_32FC2 -> CV_32FC1) inverse 2) complex-to-complex (CV_32FC2 -> CV_32FC2) forward and complex-to-complex(CV_32FC2 -> CV_32FC2) inverse Full size spectrum (CV_32FC2) is produced in the forward DFT. In this case the flags are forward -> 0 inverse -> DFT_INVERSE The result of inverse transform is a complex matrix (CV_32FC2), hence you need to split it and extract the desired result from the zero channel. Later the data needs to be scaled explicitly: As simple as that! I have no idea why I didn't come across this earlier. I decided to post it any way as someone out there might have the same problem or need some guidance. |
2013-04-12 09:02:53 -0600 | asked a question | OpenCV gpu::dft distorted image after inverse transform I'm working on GPU implementation of frequency filtering of an image. My code works great on CPU (I used something like this) but I have spent whole day trying to make the same work on GPU - without success. I want to apply a filter in the frequency domain hence I need the full (complex) result of the forward transform. I have read that I need to pass two complex matrices (src and dst) to forward dft to obtain full spectrum (32FC2). However, I fail to obtain the same image after inverse transform (the returned image is very distorted). My code (with the closest result): Your help and suggestions are much appreciated. |