2015-10-06 3757 views

回答

38

您可以使用rowscols

cout << "Width : " << src.cols << endl; 
cout << "Height: " << src.rows << endl; 

size()

cout << "Width : " << src.size().width << endl; 
cout << "Height: " << src.size().height << endl; 
13

也为OpenCV的Python中,你可以这样做:

img = cv2.imread('myImage.jpg') 
height, width, channels = img.shape 
+0

好,但OP是要求C++ – Petruza

+0

是的,这是真的,但谷歌搜索的Python带来 你在这里。 – imoutidi

相关问题