> For the complete documentation index, see [llms.txt](https://capellac.gitbook.io/opencv/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capellac.gitbook.io/opencv/week1/opencv-basics/shapes-and-texts.md).

# Shapes and Texts

## :black\_medium\_small\_square: giving color values to specific area

```
import cv2
import numpy as np

img = np.zeros((512,512,3),np.uint8)
img[200:300, 100:300] = 255,0,0

cv2.imshow("Image", img)


cv2.waitKey(0)
```

{% hint style="danger" %}
We don't no longer add 'import lines' again and again.
{% endhint %}

{% hint style="info" %}
cv2.FILLED might be used as thickness in arguments.
{% endhint %}

## :chopsticks: Line

```
img = np.zeros((512,512,3),np.uint8)

cv2.line(img,(0,0), (300, 300), (0, 255, 0), 3)
#cv2.line(img, (0,0), (img.shape[1], img.shape[0]), (0,255,0), 3) for diagonal line.

cv2.imshow("Image", img)

cv2.waitKey(0)
```

## :black\_large\_square: Rectangle

```
cv2.rectangle(img, (0,0), (250,300), (255, 0, 0), 4)
```
