Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV Rect conventions – What is x, y, width, height?

I'm studying the OpenCV tutorial found here. I am a little confused about what is represented in the following line of code:

let trackWindow = new cv.Rect(150, 60, 63, 125);

I'm not sure what the convention is with regards to what exactly is represented by x, y, width, height in this case. I made a drawing showing what I think it is. Could you please let me know if my understanding is correct?

enter image description here

like image 929
Anters Bear Avatar asked Jul 17 '19 05:07

Anters Bear


1 Answers

The convention is as follows, it is x,y,w,h as you said, x,y are the coordinates for the top left corner of the box, and w,h are just the width and height, that's it, and similarily the origin of the image is from the top left, not bottom left, as specified by your drawing

Here is a diagram to better illustrate this

enter image description here

like image 78
Imtinan Azhar Avatar answered Sep 16 '22 11:09

Imtinan Azhar