You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RuntimeError: Unsupported image type, must be 8bit gray or RGB image #21
Hello and thank you for this great resource, please see if you can help me to the right direction to fix this error:
"I tried to run this example "facerec_from_webcam.py" and got the following error"
Traceback (most recent call last):
File "facecam.py", line 22, in
face_locations = face_recognition.face_locations(frame)
File "/home/namong/.local/lib/python3.5/site-packages/face_recognition/api.py", line 85, in face_locations
return [_rect_to_css(face) for face in _raw_face_locations(img, number_of_times_to_upsample)]
File "/home/namong/.local/lib/python3.5/site-packages/face_recognition/api.py", line 74, in _raw_face_locations
return face_detector(img, number_of_times_to_upsample)
RuntimeError: Unsupported image type, must be 8bit gray or RGB image."
There is no image (video frame) received from your webcam. Meaning its not initialized right. You can confirm this using "cv2.VideoCapture.open (device ID)". This should return a True if all is good.
There is no image (video frame) received from your webcam. The device ID mentioned on this line "video_capture = cv2.VideoCapture(0)" could be other than 0 if you are using an webcam via USB.
Thank you for your response, visionanand. The instruction in that link does not work for me, there are several errors when I tried those commands. It probably because i am using Ubuntu 16. I will give it another try sometime tomorrow then
When i try to run this command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON this Cmake error pops up :
CMake Error: The source directory "/home/quantum/Quantum/Machine Learning/face_recognition-master/opencv-3.2.0/build/WITH_OPENGL=ON" does not exist.
what do i do ?
Activity
abala003 commentedon Mar 20, 2017
I got the same error. There could be two reasons,
Solution:
cv2 doesn't compile with FFmpeg be default. Pip uninstall Opencv and follow the steps mentioned in this link
http://www.wiomax.com/compile-opencv-and-ffmpeg-on-ubuntu/
verify if the webcam has a device ID 0.
Hope this helps.
5ong commentedon Mar 21, 2017
Thank you for your response, visionanand. The instruction in that link does not work for me, there are several errors when I tried those commands. It probably because i am using Ubuntu 16. I will give it another try sometime tomorrow then
-namong
vishwassathish commentedon Jun 30, 2017
When i try to run this command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON this Cmake error pops up :
CMake Error: The source directory "/home/quantum/Quantum/Machine Learning/face_recognition-master/opencv-3.2.0/build/WITH_OPENGL=ON" does not exist.
what do i do ?
karlxuthus commentedon Mar 9, 2018
My operating System is win10 .
Can I follow it ?
daniel-onyenwee commentedon Aug 14, 2024
The problem is simple the image format is in RGBA, so convert the image to RGB it works for me