What is the use of 2 here

in cv2.rectangle after we give color what is the use of the 2 before the bracket closes

Hey @sankalparora5, here you go :

Syntax: cv2.rectangle(image, start_point, end_point, color, thickness)

Parameters:

image: It is the image on which rectangle is to be drawn.

start_point: It is the starting coordinates of rectangle. The coordinates are represented as tuples of two values i.e. (X coordinate value, Y coordinate value).

end_point: It is the ending coordinates of rectangle. The coordinates are represented as tuples of two values i.e. (X coordinate value, Y coordinate value).

color: It is the color of border line of rectangle to be drawn. For BGR, we pass a tuple. eg: (255, 0, 0) for blue color.

thickness: It is the thickness of the rectangle border line in px. Thickness of -1 px will fill the rectangle shape by the specified color.

So 2 here specifies the thickness of the border line that you draw.

Hope this clears your doubt.
Happy coding :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.