2015-06-18 20:28:44 -0500 commented question please help regarding cropping a complex matrix Hi Berak, Thanks a lot. I was thinking that cv_8U might cause a problem because the cropped portion is of complex type and the surrounding 0's are of cv_8u type. Can you suggest if I use q.type() for the masks matrix type why complexI.copyTo(cropped, temp) doesn't work? :( 2015-06-18 00:33:57 -0500 asked a question please help regarding cropping a complex matrix Hi, I don't know why I can't access the other account I opened in Feb this year. So thanks to thudor who replied to my question in February. Now the problem I am facing is, (I am still novice in opencv, so please bear): I am taking DFT of an image. From the complex output I am cropping a circular portion surrounding a set of coordinates. I am doing inverse Fourier Transform of this cropped Image (the size of the cropped image is equal to the complex output of DFT). Now when I take the magnitude of the IDFT its fine. But the phase is not what I get in MATLAB. I mean the pattern. So, I tried to look at the possible troubles. When I am cropping the image, I am creating a mask. temp = new_mask(complexI, real_center);  Mat new_mask(Mat q, max_intensity m) { Mat masks = Mat::zeros(q.size(), CV_8U); circle(masks, Point(m.col_ref, m.row_ref), int(filter_rad), Scalar(255, 255, 255), -1, 8, 0); //-1 means filled return masks;  } And then using this mask I am cropping the complex matrix. Mat cropped(complexI.size(), complexI.type(), Scalar::all(0)); complexI.copyTo(cropped, temp);  Do you think, because I used CV_8U as the type of the mask matrix it is causing trouble when I am doing inverse Fourier transform? Please suggest. I tried using other data types like CV_64FC2 but then the sentence complexI.copyTo(cropped, temp) doesn't work. Even if I use the type complexI.type() for the masks matrix this sentence doesn't work. I am giving an example of the comparison of phase output of IDFT in MATLAB and opencv. PLEASE HELP!!! The blue line is MATLAB output and the red one is opencv. THANKS A LOT IN ADVANCE whoever helps :)