extract values from planes[0] of FFT application

asked 2015-12-08 04:56:42 -0600

rourou11 gravatar image

updated 2015-12-08 07:09:44 -0600

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
}

  }
}
edit retag flag offensive close merge delete

Comments

Please, format your code properly

LorenaGdL gravatar imageLorenaGdL ( 2015-12-08 05:04:16 -0600 )edit