Ask Your Question
0

DFT crop the spectrum due to pad 0

asked 2015-08-08 02:56:00 -0600

JiangFeng gravatar image

In the opencv_tutorials,the example 2.8 Discrete Fourier Transform we pad the image with 0,when we finish DFT we need to throw away the newly introduced values,but i can not understand this statement "magI = magI(Rect(0, 0, magI.cols & -2, magI.rows & -2));"

can someone explain this to me,Thanks a lot!

image description

edit retag flag offensive close merge delete

Comments

1

Is it this link

LBerger gravatar imageLBerger ( 2015-08-08 03:32:56 -0600 )edit

1 answer

Sort by » oldest newest most voted
3

answered 2015-08-08 03:43:03 -0600

LBerger gravatar image

updated 2015-08-09 02:35:58 -0600

Example :

int mmm=-2;
int www=256&mmm;
cout << www <<"\n";
www=257&mmm;
cout << www <<"\n";

It gives 256 256

like this you are sure you can have a integer center ( no remainder) for following lines

int cx = magI.cols/2;
int cy = magI.rows/2;

PS -2 = 0xfffffffe

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-08-08 02:56:00 -0600

Seen: 19,807 times

Last updated: Aug 09 '15