Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIDTH and HEIGHT parameters in OpenCV

Tags:

python

opencv

l'm a little bit confused on width and height parameter :

Is the height which is the first parameter or the second ?

HEIGHT,WIDTH= img.shape[0:2] or WIDTH,HEIGHt= img.shape[0:2]

and in resize function height=32 and width=100 or the inverse ?

image=cv2.resize(img, (32, 100), interpolation=cv2.INTER_NEAREST)
like image 430
vincent75 Avatar asked Oct 17 '25 03:10

vincent75


1 Answers

With .shape it's HEIGHT, WIDTH = img.shape[0:2]. The reason for this, is it's a numpy matrix, where the first value means number of rows, and the second is number of columns.

When you resize it's img = cv2.resize(img, (WIDTH, HEIGHT)).

like image 161
tituszban Avatar answered Oct 19 '25 19:10

tituszban



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!