Как передать кадр img из другого класса?
Пример:
У меня есть process.py
import cv2
from camera import Camera
from fire_detection import FireDetection
camera = Camera()
camera.connect()
while True:
frame = camera.get_frame()
if frame is not None:
#Especifico a configuração dos bombeiros
FireDetection = FireDetection.configBombeiros(frame)
#cv2.imshow('frame', frame)
if cv2.waitKey(100) & 0xFF == ord('q'):
camera.disconnect()
cv2.destroyWindow('frame')
В этом классе я вызываю FireDetection = FireDetection.configBombeiros (frame) и передать кадр в качестве параметра, но я получил эту ошибку:
Traceback (most recent call last):
File "processamento.py", line 11, in <module>
FireDetection = FireDetection.configBombeiros(frame)
File "E:\Matheus\MachineLearning\mvc_fogo\novo padrao\fire_detection.py", line 17, in configBombeiros
mascara = cv2.inRange(rgb, minimo, maximo)
TypeError: Expected Ptr<cv::UMat> for argument '%s'
Класс fireDetection ()
import cv2
class FireDetection(object):
def __init__(self):
print('Inicio')
def configBombeiros(frame):
minimo = [170, 0, 245]
maximo = [220, 255, 255]
blur = cv2.GaussianBlur(frame, (21, 21), 0)
#Metodo de detecção de cor (pode ser usado HSV ou RGB) RGB se utiliza o metodo padrão de cor, exemplo: Vermelho 255,0,0
rgb = frame.copy()
mascara = cv2.inRange(rgb, minimo, maximo)
cv2.imshow('frame', frame)