#include <opencv2\core\core.hpp>
#include<opencv2\imgproc\imgproc.hpp>
#include<opencv2\highgui\highgui.hpp>
#include <iostream>
#include<conio.h>
using namespace cv;
using namespace std;
int main()
{
Mat im= imread("D:\\try.jpg"),newface,A;
Mat im2 = imread("D:\\project\\barc\\variables\\Eigenface.jpg");
cvtColor(im, im, CV_BGR2GRAY);
cvtColor(im2, im2, CV_BGR2GRAY);
resize(im, im, Size(48, 48));
newface = im.reshape(0, 2304);
newface.convertTo(newface, CV_32FC1);
im2.convertTo(im2, CV_32FC1);
cout << "Diff : " << newface.size() << "\t" << "channels" << newface.channels() << endl;
cout << "Eigen : " << im2.size() << "\t" << "channels" << im2.channels() << endl;
A = im2*newface.t();
_getch();
return 0;
}
Eigenface.jpg 的尺寸为 (9x2304)。当我与图像相乘时,我遇到了这个错误,有人能帮忙吗?
请检查矩阵 M1,M2M1.cols == M2.rows。如果它们不相等,则乘法是不可能的!
我是一名优秀的程序员,十分优秀!