You are on page 1of 3

In [1]:

import cv2
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
blank_img = np.zeros(shape=(512,512,3),dtype=np.int16)

In [3]:
#plt.imshow(blank_img)
blank_img = cv2.imread('D:/1234.jpg')

In [4]:
cv2.rectangle(blank_img,pt1=(200,300),pt2=(700,800),color=(0,0,255),thickness=10)
plt.imshow(blank_img)

Out[4]:
<matplotlib.image.AxesImage at 0x20fbc8c4f60>

In [5]:
circ_img = cv2.imread('D:/1234.jpg')

In [6]:
cv2.circle(circ_img,center=(450,550),radius=300,color=(0,0,255),thickness=10)
plt.imshow(circ_img)

Out[6]:
<matplotlib.image.AxesImage at 0x20fbccbbb38>
In [7]:
fil_circ_img = cv2.imread('D:/1234.jpg')

In [24]:
cv2.circle(fil_circ_img,center=(450,550),radius=300,color=(0,0,255),thickness=-1)
plt.imshow(fil_circ_img)
Out[24]:
<matplotlib.image.AxesImage at 0x20fbdf6ab38>

In [9]:
lin_img = cv2.imread('D:/1234.jpg')

In [10]:
cv2.line(lin_img,pt1=(0,0),pt2=(1000,1148),color=(255, 0, 0),thickness=50)
cv2.line(lin_img,pt1=(999,0),pt2=(0,1148),color=(255, 0, 0),thickness=50)
plt.imshow(lin_img)
Out[10]:
<matplotlib.image.AxesImage at 0x20fbde67390>

In [11]:
lin_img.shape
Out[11]:
(1148, 999, 3)

In [12]:
txt_img = cv2.imread('D:/1234.jpg')

In [25]:
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(txt_img,text='Hello',org=(150,800), fontFace=font,fontScale= 10,color=(255,0
,0),thickness=20,lineType=cv2.LINE_AA)
plt.imshow(txt_img)

Out[25]:
<matplotlib.image.AxesImage at 0x20fbdfc1a20>

In [145]:
poly_img = cv2.imread('D:/1234.jpg')

In [146]:
vertices = np.array([[200,550],[400,250],[700,550],[400,850]],np.int32)
pts = vertices.reshape((-1,1,2))

In [147]:
cv2.polylines(poly_img,[pts],isClosed=True,color=(255,0,0),thickness=5)
plt.imshow(poly_img)
Out[147]:
<matplotlib.image.AxesImage at 0x20fc5bfc208>

In [ ]:

In [ ]:

You might also like