Draws a simple, thick, or filled up-right rectangle
img = cv.rectangle(img, pt1, pt2)
img = cv.rectangle(img, rect)
[...] = cv.rectangle(..., 'OptionName', optionValue, ...)
Input
- img Image.
- pt1 Vertex of the rectangle
[x1,y1]
.
- pt2 Vertex of the recangle opposite to
pt1
, [x2,y2]
.
- rect Alternative specification of the drawn rectangle
[x,y,w,h]
.
Output
- img Output image, same size and type as input
img
.
Options
- Color Rectangle color or brightness (grayscale image). default zeros
- Thickness Thickness of lines that make up the rectangle. Negative
values (like -1) or the string 'Filled', mean that the function has
to draw a filled rectangle. default 1.
- LineType Type of the line boundary. One of 8,4,'AA' (Anti-aliased
line). default 8.
- Shift Number of fractional bits in the point coordinates. default 0
The function cv.rectangle draws a rectangle outline or a filled rectangle
whose two opposite corners are pt1
and pt2
, or [x,y]
and
[x+w-1,y+h-1]
(top-left and bottom-right corners of rectange used in the
second variant of the function).