Open CV
Open CV
Write
Python code using OpenCV to accomplish the following tasks:
2. Read the image file.
3. Display the image.
4. Convert the image to grayscale.
5. Display the grayscale image.
Answer::
import cv2
image = cv2.imread('landscape.jpg')
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.title('Original Image')
plt.axis('off')
plt.show()
plt.imshow(gray_image, cmap='gray')
plt.title('Grayscale Image')
plt.axis('off')
plt.show()
2. You're tasked with implementing a basic face recognition system using OpenCV in
Python. Write code to accomplish the following steps:
Answer::
import cv2
cap = cv2.VideoCapture(0)
while True:
break
cap.release()
cv2.destroyAllWindows()
3. You're tasked with building a face recognition system to detect and recognize
faces in an image using OpenCV in Python. Write code to accomplish the following
steps:
Answer ::.
import cv2
recognizer = cv2.face.LBPHFaceRecognizer_create()
cv2.waitKey(0)
cv2.destroyAllWindows()