img=cv.imread(‘/B.jpg’)
cv2_imshow(img)
print(“Image Properties”)
print(“Number of Pixels : ” + str(img.size))
print(“Shape/Dimensions : ” + str(img.shape))
print(img.dtype)
print(img.shape[0])
print(img.shape[1])
print(img.shape[2])
img_grey=cv.cvtColor(img,cv.COLOR_BGR2GRAY)
cv2_imshow(img_grey)
blue,green,red=cv.split(img)
cv2_imshow(red)
print(“\n”)
cv2_imshow(blue)
print(“\n”)
cv2_imshow(green)
height,width=img.shape[:2]
print(height)
print(width)
img_resize=cv.resize(img,(int(width/2),int(height/2)),interpolation=cv.INTER_LINEAR)
cv2_imshow(img_resize)
print(“\n”)
img_resize=cv.resize(img,(int(width/2),int(height/2)),interpolation=cv.INTER_CUBIC)
cv2_imshow(img_resize)
print(width)
print(height)
mat=cv.getRotationMatrix2D((int(width/2),int(height/2)),45,1)
img_rotate=cv.warpAffine(img,mat,(width,height))
cv2_imshow(img_rotate)
M=np.float32([[1,0,100],[0,1,50]])
img_translation=cv.warpAffine(img,M,(width,height))
cv2_imshow(img_translation)
img_neg=1-img
cv2_imshow(img_neg)
print(“\n”)
a=np.array(img.data)
b=a.max()
img_neg1=b-img
cv2_imshow(img_neg1)
Please follow and like us: