1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <opencv2/opencv.hpp>
int main(int argc, char **argv){
std::complex<double>
x[] = {
-1, -1, -1,
0, 0, 0,
1, 1, 1
},
y[] = {
-1, 0, 1,
-1, 0, 1,
-1, 0, 1
};
cv::Mat X(3, 3, CV_64FC2, x); //complex double matrix
cv::Mat Y(3, 3, CV_64FC2, y);
//Y *= std::complex<double>(0,1); //no match for operator...
//it seems that you'll need to create the loop
for(int K=0; K<Y.rows; ++K)
for(int L=0; L<Y.cols; ++L)
Y.at<std::complex<double> >(K,L) *= std::complex<double>(0,1);
cv::Mat Z = X*Y;
for(int K=0; K<Z.rows; ++K){
for(int L=0; L<Z.cols; ++L)
std::cout << Z.at<std::complex<double> >(K,L) << ' ';
std::cout << '\n';
}
return 0;
}
|
(0,3) (0,0) (0,-3)
(0,0) (0,0) (0,0)
(0,-3) (0,0) (0,3) |