0

I am trying to run a facedetector program from cvzone in PyCharm. This is a brand new PC and I installed mediapipe in Pycharm as I have done in other computers. for a reason I do not understand I get this message:

ERROR:

File
"C:\Users\myName\PycharmProjects\ArduinoCV\venv\lib\site-packages\mediapipe\python\solution_base.py", line 238, in __init__
    binary_graph_path=os.path.join(root_path, binary_graph_path)) 
    FileNotFoundError: The path does not exist. [ WARN:0] global
C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-_xlv4eex\openc\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB
terminating async callback

CODE:

import cv2
from cvzone.FaceDetectionModule import FaceDetector
cap = cv2.VideoCapture(0)

detector = FaceDetector()

while True:
    success, img = cap.read()
    img, bboxs = detector.findFaces(img)
    cv2.imshow("Imagen", img)
    cv2.waitKey(1)

I am sure is not the program because it runs fine on the other computers, so I am guessing it has to do with the way python or mediapipe is installed on this new computer. Could it be a windows 10 problem? Any help would be appreciated about how to solve this issue.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • 1
    Welcome to Stack Overflow! Your code is doing `success, img = cap.read()` but doesn't check the returned value of `success`, which will be `False` if no frames have been grabbed. You say you conclude that the problem is the way the software is installed. But there is another variable in the mix, which is the camera. So start by checking if `cap.read()` succeeds, instead of just assuming that it does. – BoarGules Oct 11 '21 at 16:16
  • @BoarGules Thank you very much for the insight. I tried the code without the cv2 lines (lines 5 and 9) and it works, I can see the Webcame image, so it cannot be a cap.read() problem. It its very likely related to Mediapipe. I still think it may be the way python is installed in Windows. Do you know any way to figure out where to find the graph path in the computer? Thank you again – Alejandro Vaquero Oct 12 '21 at 16:17

0 Answers0