Professional Documents
Culture Documents
1 Part 2
1 Part 2
import numpy as np
from PIL import Image
import cv2
import imageio
import math
plt.imshow(poly)
x=np.zeros([28,28,3],dtype=np.uint8) #an array which contain all pixels with zero
value
#cv2.imshow('first_image',I)
I.save('/home/ravi/Documents/Assignmntnjddsofjdjofjodjfdjo/first.png') #saving a
photo of black background
q1 = cv2.imread('/home/ravi/Documents/Assignmntnjddsofjdjofjodjfdjo/first.png')
#loading the image
###########################################################################
for i in range(50,200):
for j in range(50,200):
white_sqr[i,j] = (255, 255, 255) #setting the pixel as white
second_im.show()
cv2.waitKey(0) # waits until a key is pressed
cv2.destroyAllWindows() # destroys the window showing image
###################################################################################
##############
###################################################################################
#######################
##q8-Draw-
#1. Diagonal blue line with thickness of 6 pixels
#A ractange 3 An ellipse A polygon
import numpy as np
from PIL import Image
import cv2
import imageio
import math
x=np.zeros([28,28,3],dtype=np.uint8) #creating the background
cv2.waitKey(0)
cv2.destroyAllWindows()
##drawing an ellipse
import cv2
from matplotlib import pyplot as plt
backgr = np.ones((200,200,3)) #a 200*200 pixel image with 3 channels
angL = 0 #inclination
centreofell = (centre_x,centre_y)
axes = (major_ax,minor_ax)
#####drawing a polygon
poly = cv2.polylines(backr_poly,[pts],True,(0,255,255))
plt.imshow(poly)