'"AttributeError: 'numpy.ndarray' object has no attribute 'cv2' " error. alraedy installed opencv-contrib-python and others also in different version
import cv2
import numpy as np
import face_recognition
imgRohit = face_recognition.load_image_file('images/Rohit.jpg')
imgRohit = cv2.cvtColor(imgRohit.cv2.COLOR_BGR2RGB)
imgRohit_1 = face_recognition.load_image_file('images/Rohit_1.jpg')
imgRohit_1 = cv2.cvtColor(imgRohit_1.cv2.COLOR_BGR2RGB)
cv2.imshow('Rohit', imgRohit)
cv2.imshow('Rohit_1', imgRohit_1)
cv2.waitKey(0)
Solution 1:[1]
Instead of the dot in imgRohit = cv2.cvtColor(imgRohit.cv2.COLOR_BGR2RGB)
between imgRohit
and cv2.COLOR_BGR2RGB
, It should be a comma.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stella Fournier |