以下以dct变换为例说明Mat中的数据类型
Mat M =imread("D:\\Matlab_doc\\lena.jpg");
cvtColor(M,M,CV_BGR2GRAY);
cout<<"M\ttype:"<<M.type()<<"\tdepth:"<<M.depth()<<endl; //输出 0 0 8位uchar型
imshow("M",M);
waitKey();
Mat N;
M.convertTo(N,CV_32FC1);
cout<<"N\ttype:"<<N.type()<<"\tdepth:"<<N.depth()<<endl; //输出 5 5 32位float型
imshow("N",N / 255); //归一化
waitKey();
Mat P;
dct(N,P); //dct
cout<<"P\ttype:"<<P.type()<<"\tdepth:"<<P.depth()<<endl; //输出 5 5 32位float型
Mat Q;
idct(P,Q); //idct
cout<<"Q\ttype:"<<Q.type()<<"\tdepth:"<<Q.depth()<<endl; //输出 5 5 32位float型
imshow("Q",Q / 255); //归一化
waitKey();
Mat X;
Q.convertTo(X,CV_8UC1);
cout<<"X\ttype:"<<X.type()<<"\tdepth:"<<X.depth()<<endl; //输出 0 0 8位uchar型
imshow("X",X);
waitKey();