#corner detection import cv2 import numpy as np image_path = "corners.jpg" image = cv2.imread(image_path) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) gray = np.float32(gray) dst = cv2.cornerHarris(gray, 2, 3, 0.04) dst = cv2.dilate(dst, None) image[dst > 0.01 * dst.max()] = [0, 0, 255] cv2.imshow("Harris Corner Detection", image) cv2.waitKey(0) cv2.destroyAllWindows() #face detection import cv2 image_path = "faces.jpg" image = cv2.imread(image_path) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5) for (x, y, w, h) in faces: cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 2) cv2.imshow("Face Detection", image) cv2.waitKey(0) cv2.destroyAllWindows()