Ask Your Question
0

Vec2f , mulSpectrums

asked 2016-07-12 17:29:37 -0600

HiHello gravatar image

i got the answer about mulSpectrum like this.

Mat z1(1,2,CV_32FC2),z2(1,2,CV_32FC2),z3;

z1.at<vec2f>(0, 0) = Vec2f(1,1);//1+i

z1.at<vec2f>(0, 1) = Vec2f(2,3);//2+3i

z2.at<vec2f>(0, 0) = Vec2f(2,1);//2+i

z2.at<vec2f>(0, 1) = Vec2f(3, 3);//3+3i

mulSpectrums(z1,z2,z3,0); cout<<z3; (1+i)<em="">(2+i) and (2+i)(3+3i) waitKey();

how can i change IplImage* to the form like above? do i have to use "for loop"? i meat that

CvMat* freq;

For example, (R0, I0), (R1, I1), (R2, I2), (R3, I3)..(Rn,In)

freq->data.db[0] means R0, freq->data.db[1] means I0,

freq->data.db[2] means R1, freq->data.db[3] means I1,

freq->data.db[4] means R2, freq->data.db[5] means I2, ...

something like this. i dont know how to convert that data to Vec form.

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-07-12 18:58:20 -0600

Tetragramm gravatar image

If at all possible, you should not be using an IplImage. That is part of the C API, and is discouraged as strongly as possible. I suggest re-writing whatever you have in C++ using Mat and the other C++ classes and functions, then accessing it as you have there. THIS TUTORIAL explains why it's a good idea, and how to use the Mat class.

If that is not possible, the cvarrToMat function can create a Mat out of an IplImage which can be accessed as normal.

If ALL of that doesn't work (IE, you're actually writing in C), then there is a C version of mulSpectrums that will work on the C arrays.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-07-12 17:29:37 -0600

Seen: 1,203 times

Last updated: Jul 12 '16