OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 18 Jan 2018 05:08:08 -0600Accuracy of OpenCV's DFT (C++ implementation)http://answers.opencv.org/question/182729/accuracy-of-opencvs-dft-c-implementation/I'm coding a with C++ and OpenCV. I'm comparing the outputs (complex numbers) of MATLAB's FFT function and OpenCV's DFT function. I am able to get identical results for normal images such as the one below (Fig. 1). However, after some processing to get the image (Fig. 2), the values are very different by orders of magnitude and I think the OpenCV's output is wrong.
Is this expected of the OpenCV's DFT function? I've tried all sorts of things like putting "DFT_SCALE" as well. Any suggestions please? Thanks!
![Fig.1](/upfiles/15162731822390162.jpg)
![Fig.2](/upfiles/15162732072692394.jpg)
I've also included my MATLAB code. Fig.1 is the variable assigned "S" and Fig.2 is the variable "Normin2". (product of imshow(Normin2)). Normin2 has a maximum value of 1.359 and a minimum value of -1.2667.
![MATLAB code](/upfiles/15162755494912427.jpg)Colin PeerisThu, 18 Jan 2018 05:08:08 -0600http://answers.opencv.org/question/182729/extract values from planes[0] of FFT applicationhttp://answers.opencv.org/question/78560/extract-values-from-planes0-of-fft-application/Hello,
I want to rearrange values from planes[0] after computing FFT in image in order to display amplitude image but how to browser it.
Thanks.
Mat magI;
cv::Mat phase;
img->load(liste[0]);
*img = img->scaled(widget.imageLabel->width(), widget.imageLabel->height(),Qt::IgnoreAspectRatio,Qt::FastTransformation);
QPixmap pixmap=QPixmap(QPixmap::fromImage(*img));
int rows=pixmap.width();
int cols=pixmap.height();
cv::vector<int> pixels;
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
for(int k=0;k<liste.size();k++)
{
cv::Mat I = imread(liste[k].toStdString().c_str(), CV_LOAD_IMAGE_GRAYSCALE);
int fftp = I.at<uchar>(j,i);
pixels[k]=fftp; }
cv::Mat ff;
cv::dft(pixels, ff, cv::DFT_ROWS|cv::DFT_COMPLEX_OUTPUT);
cv::Mat planes[] = {cv::Mat::zeros(pixels.size(),1, CV_32F), cv::Mat::zeros(pixels.size(),1, CV_32F)};
cv::split(ff, planes);
magnitude(planes[0], planes[1], planes[0]);
int m = planes[0].cols;
for(int l=0;l<m;l++)
{
magI.at<uchar>(j,i) = planes[0].0;//ERROR Iwant to put the first value of planes[0] in the first point in the image HOW
}
}
}
rourou11Tue, 08 Dec 2015 04:56:42 -0600http://answers.opencv.org/question/78560/computing FFT at a pixel in image with opencvhttp://answers.opencv.org/question/78450/computing-fft-at-a-pixel-in-image-with-opencv/hello, I want to applicate FFT at one pixel in image at get the complex composants with opencv.
please help me.
Thanks. rourou11Mon, 07 Dec 2015 08:32:59 -0600http://answers.opencv.org/question/78450/