1 | initial version |
"I have to set all the parameters of the Mat structure." - no, you can use a Mat constructor for this:
grayscale img:
mexImg * mex;
Mat gray( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pBw );
imshow("image", gray);
color img:
mexImg * mex;
Mat rgb[3] = {
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pBlue ),
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pGreen ),
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pRed )
};
Mat img;
merge(rgb,3,img);
imshow("image", img);
2 | No.2 Revision |
"I have to set all the parameters of the Mat structure." - no, you can use a Mat constructor for this:
grayscale img:
mexImg * mex;
Mat gray( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pBw );
imshow("image", gray);
waitKey(0);
color img:
mexImg * mex;
Mat rgb[3] = {
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pBlue ),
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pGreen ),
Mat( mex->dimY, mex->dimX, CV_8U, (uchar*)mex->pRed )
};
Mat img;
merge(rgb,3,img);
imshow("image", img);
waitKey(0);