CG & Ip Lab
CG & Ip Lab
CG & Ip Lab
PROGRAM NO.7: Write a Program to read a digital Image. Split and display into 4 quadrants, up,
down, right and left.
# import opencv
import cv2
import numpy as np
import os
cv2.waitKey(0)
cv2.destroyAllWindows()
# display the quadrants
cv2.imshow('quadrant1', quadrant1)
# cv2.waitKey(0)
cv2.imshow('quadrant2', quadrant2)
# cv2.waitKey(0)
cv2.imshow('quadrant3', quadrant3)
# cv2.waitKey(0)
cv2.imshow('quadrant4', quadrant4)
cv2.waitKey(0)
cv2.destroyAllWindows()
PROGRAM NO.8: Write a Program to show rotation, scaling, and translation on an image.
import cv2
import numpy as np
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.waitKey(0)
cv2.waitKey(0)
PROGRAM NO.9: Read an image and extract and display low-level features such as edges, textures
using filtering techniques.
import cv2
import cv2
import numpy as np
# Load an image using 'imread' specifying the path to image
image = cv2.imread('test.jpg')
import cv2
import numpy as np
import cv2
# read image
image = cv2.imread('face.jpg')
# detect face
faces = detect_face(image)
# draw rectangle around the faces
draw_rectangle(image, faces)
# display the image
cv2.imshow('Face Detection', image)
cv2.waitKey(0)
cv2.destroyAllWindows()