issue when streaming ip camera for face recognition onTX2

Hi, i have an issue when i want to stream from ip camera

this is what i’ve been doing:

import face_recognition
import cv2
import numpy as np
import os
import glob

video_capture = cv2.VideoCapture("rtspsrc location=rtsp://admin:cognixy123@ ! decodebin ! videoconvert ! xvimagesink", cv2.CAP_GSTREAMER)

#i skip the load image process 

while True:
    # Grab a single frame of video
    ret, frame =

    # cv2.imwrite('./saved/frame%d.jpg' % count,frame)
    # count+=1

    # Resize frame of video to 1/4 size for faster face recognition processing
    small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)

    # Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
    rgb_small_frame = small_frame[:, :, ::-1]

when i run the script, i have the following message

Traceback (most recent call last):
  File "", line 60, in <module>
    small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
cv2.error: OpenCV(4.1.1) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

when i use usb camera, there’s no problem at all with my script. i’m using hikvision DS-2CD1023G0-I

does anyone have the solution for this problem? any answer would be appreciated it. thanks!


It looks like you are using a customized OpenCV, have you built it with GStreamer support?
If you are not sure about this, would you mind to rebuild it with this script?