@IvanTRG

Что мне делать, если не работает программа?

пишу программу по распознаванию изображения в реальном времени, но выходит ошибка, может кто подскажет, что делать?
from threading import Timer
from imageai.Detection import ObjectDetection
import cv2
import os

# захватываем фрейм с веб-камеры
cap = cv2.VideoCapture(0)
for i in range(30):
    cap.read()


def timer():
    # Code executed here
    # читаем фрейм
    ret, frame = cap.read()
  
    # отзеркаливаем фрейм по оси y
    flipped_frame = cv2.flip(frame, 1)

#начало распознавания объектов
    execution_path = os.getcwd()
    detector = ObjectDetection()
    detector.setModelTypeAsYOLOv3()
    detector.setModelPath( os.path.join(execution_path , "C:\programs\Real\yolov3.pt"))
    detector.loadModel()
    detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , flipped_frame), 
    output_image_path=os.path.join(execution_path , "C:\programs\photo\cam.png"), minimum_percentage_probability=30)
    for eachObject in detections:
        print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
        print("--------------------------------")

     # сохраняем полученное изображение
    #cv2.imwrite("C:\programs\photo\cam.png", execution_path)  
    Timer(1, timer).start()

timer()


вот сама ошибка
Traceback (most recent call last):
  File "c:\programs\new.py", line 36, in <module>
    timer()
  File "c:\programs\new.py", line 26, in timer
    detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , flipped_frame),
  File "C:\python\lib\ntpath.py", line 117, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\python\lib\genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'ndarray'
  • Вопрос задан
  • 117 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
03 мая 2024, в 16:09
1200 руб./за проект
03 мая 2024, в 16:06
3000 руб./за проект
03 мая 2024, в 15:48
2000 руб./за проект