我希望使用c ++ OpenCV代码显示图像。以下是代码片段:
//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
请帮助我们了解如何显示尺寸。我已多次尝试购买失败。
答案 0 :(得分:0)
//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;