Problems with OpenCV DFT function in C++

asked 2012-10-06 06:01:55 -0500

Taimoor gravatar image

updated 2020-11-30 03:19:42 -0500

i have been trying to implement the MOSSE tracking application in c++ by converting the code line by line from the sample file which is in python. The problem is that when ever i compute the dft of any image, i get different answers from from the sample application in python. Although the dft function in the python example is also from the opencv library. I have compared my output step by step with the python application and whenever there is dft or idft involved, i get different outputs. To counter check, i also checked the input type of the image which is same as the one used in the python application i.e CV_32F. I also compared the input matrix to the dft function index by index in both applications and they are exactly the same (up to 6 decimal places). the dimensions of the input matrix are same as well. The interesting thing to note here is that not all the values in the output matrix are wrong. for example if the image is 4 by 4 pixels, then only the 4th column has wrong values in it. and if i increase the size of the input matrix, the column number with wrong values increase. i have used the same flags for producing complex out, exactly the same as it has been used in the python application(which by the way works perfectly fine). I have been stuck on this for about two days now and i have tried every trick in my book but i am stil unable to solve this problem. Any help will be greatly appreciated. Thank You, Taimoor Naveed

edit retag flag offensive close merge delete


Hey, I'm trying to write the in cpp too, and I'm facing problems similar to yours. Did u find any solution to them?

nik149 gravatar imagenik149 ( 2014-06-06 19:01:08 -0500 )edit

I am also trying to do the same thing. Has anyone been able to figure this out?

jcheney44 gravatar imagejcheney44 ( 2014-08-28 10:41:58 -0500 )edit

Hey! I'm having the same problem trying to translate from python to c++. Were you able to complete it and if so, are you able to provide the source code in c++? Greetings

Jgamp gravatar imageJgamp ( 2015-04-06 09:03:39 -0500 )edit

was this ever solved?

soulslicer0 gravatar imagesoulslicer0 ( 2018-04-26 10:39:27 -0500 )edit