Dip Asnam
Dip Asnam
NAME::Irfan Haider
CLASS: BCE-7
ENROLLMENT NO: 01-132182-035
import cv2
import numpy as np
img = cv2.imread('Irfan.jpg',0);
img512 = cv2.resize(img,(512,512));
cv2.imshow('orig',img);
cv2.imshow('512x512',img512);
cv2.imshow('128x128',img128);
cv2.imwrite('img128.jpg',img128);
cv2.waitKey(0);
Code
import numpy as np
import cv2
import math
def color(imgSize):
cornerSize = int(math.floor(imgSize/8));
img = np.ones((imgSize,imgSize,3));
#red
#green
#blue
#black
cv2.imshow('Asnam',img);
cv2.waitKey(0);
return;
color(800);
Conclusion
In question 1 I have read the original image and the convert into 512x512 size and then convert to
128x128.
In question 2 I have created a function for white image and then I have created 4 boxes of Red green
blue and black the corner of image