RGB error python
error generated after a runtime
Traceback (most recent call last): File "C:/detectordeobjetos/setup.py", line 31, in <module> objetosDetectados = detector(frame) RuntimeError: Unsupported image type, must be 8bit gray or RGB image. [h264 @ 000000cedf0fe920] negative number of zero coeffs at 78 6 [h264 @ 000000cedf0fe920] error while decoding MB 78 6
code
import dlib
import cv2
import sys
import time
import requests
ip = "rtsp://admin:[email protected]/doc/page/preview.asp"
detector = dlib.simple_object_detector('C:/detectordeobjetos/thor.svm')
ipp = ("https://httpbin.org/post")
Nome = 'Detector de Objetos'
fonte = cv2.FONT_ITALIC
captura = cv2.VideoCapture(ip)
x = 0
tempo = 0
sinal = 0
time.sleep(1.0)
> while captura.isOpened():
from datetime import datetime
data_e_hora_atuais = datetime.now()
data_e_hora_em_texto = data_e_hora_atuais.strftime('%d/%m/%Y %H:%M')
conectado, frame = captura.read()
tempo += 1
print(tempo)
sinal += 1
objetosDetectados = detector(frame)
for o in objetosDetectados:
e, t, d, f = (int(o.left()), int(o.top()), int(o.right()), int(o.bottom()))
cv2.rectangle(frame, (e, t), (d, f), (0, 255, 0), 1)
cv2.putText(frame, 'Eixo Detectado', (e, t), fonte, 1.0, (0, 255, 0), 2, cv2.LINE_4)
print("Objeto foi detectado")
tempo = 0
sinal = 0
cv2.destroyAllWindows()
time.sleep(5)
if sinal == 5:
xml = ("""<?xml version="1.0" encoding="iso-8859-1"?>
<calls>
<call>
<id>0000</id>
<mac>0013A20040A768C4</mac>
<bat>2.23</bat>
<dthora>""" + str(data_e_hora_em_texto) + """</dthora> </call> </calls>""")
url = 'http://mmscon.cnhindustrial.ind.br/cnhind/mms/cebh/roti01.php'
r = requests.post(ipp, {'data': xml}).text
print(r)
print("---Enviando Sinal ---")
sinal = 0
cv2.destroyAllWindows()
time.sleep(5)
captura.release()
cv2.destroyAllWindows()
sys.exit(0)