开发者

Problem of displaying image using OpenCV in C++

I wish to display image using c++ OpenCV code. Below are the code fragment:

//Load image
Mat img = imread("Example1.jpg");

//Display in window
namedWindow("Skin");

//display image
imshow("Skin",img);

//returns the开发者_如何学运维 matrix size
cout<<img.size()<<endl; // wrong

Please help on how to display the size. I have tried many times buy fail.


//Load image
Mat img = imread("Example1.jpg");

//Display in window
namedWindow("Skin");

//display image
imshow("Skin",img);

//returns the matrix size
cout << "width= " << img.cols << " height= " << img.rows<< endl; 
//OR if you wanna use the size() getter.
cout << "width= " << img.size().width << " height= " << img.size().height << endl;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜