简体   繁体   English

在C ++中使用OpenCV显示图像的问题

[英]Problem of displaying image using OpenCV in C++

I wish to display image using c++ OpenCV code. 我希望使用c ++ OpenCV代码显示图像。 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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM