i have been trying to implement the MOSSE tracking application in c++ by converting the code line by line from the sample file MOSSE.py 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