Output of DFT is the same as input
I have a problem with understanding DFT.
I'm trying to create simple program to test this function.
vector <complex<double> > singlePointAsComplex;
std::complex<double> c(1,2);
singlePointAsComplex.push_back (c);
Mat resMat;
dft(singlePointAsComplex, resMat, DFT_SCALE);
std::cout << "resMat = " << std::endl << resMat << std::endl;
As the output i receive:
resMat = [1, 2]
What i'm doing wrong?
the DFT of a single number is just DC, itself (so, the result is correct !).
to see anything in * frequency domain*, you need more complex input(pun, harrr), like more dimensions
I'm working with OP to solve this problem, we're both new to image analysis and the documentation is quite complicated. How should the dft() function be called if we want to calculate DFT for a single point of the image contour? I was expecting that converting both coordinates into a single complex number should be enough to pass it into dft() and get a fourier descriptor - a single value in output matrix. But probably my way of thinking is incorrect.
calculate DFT for a single point of the image contour? -- that sounds like a good point to "hook into your problem"
again, "a single point" does not make much sense here. do you intend to do some "frequency based filtering" on your contour ? (again, you'd have to pass the whole thing, not a single point)
care to explain more ?
Ok, so what we are trying to accomplish is:
And since we're stuck in point #3 and have no idea how to use dft() we decided to play with the function on the smallest possible data - a single point. However we're disappointed with the results returned.
2: "contour points" that's more than one
also, fft/dct/dtf -- it's all about mapping a continuous time spectrum to frequency domain.
for the discrete version, -- you have to make an array from 0 to tmax(or xmax, in your case), insert the values you have at known x positions, and fill the rest with zeros, again, it needs to be "continuous".
can it be, you're trying to match shapes using fourier descriptors ?
yes we are
if it's really fourier descriptors, have a look here
@LBerger, i'd be happy, if you would be taking over this one ;)
My PR is not ready today but you can first try to use this post
I think that we're trying to do something simple but without proper preparation we're unable to do anything.
Like my friend described we have an image. It's a image of object. We detect contour and put it in vector <point> ( vector with 2541 elements for example [20 , 70]. After using dft() and normalize. As output we know that we need 64 elements. It's tricky because we don't exactly know what our output is. We only know how is should look like. We don't have much information about image analysis and I think that's our biggest problem.
I believe that we should us two examples from openCV documentation: http://docs.opencv.org/2.4/doc/tutori...
doc/tutorials/core/discrete_fourier_transform/discrete_fourier_transform.html