Ask Your Question

Justas's profile - activity

2018-08-11 06:00:56 -0600 marked best answer Can't connect to cammera

I'am trying to connect to my hikvision DS-2CD2032-I camera, with no success.

Code:

import numpy as np
import cv2 as cv

cap = cv.VideoCapture('rtsp://username:password@IP:554/1')

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv.imshow('frame', gray)

    if cv.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv.destroyAllWindows()

Error:

gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) error: OpenCV(3.4.2) c:\build\3_4_winpack-bindings-win32-vc14-static\opencv\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::set&lt;3,4,-1="">,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

With the same urls (["rtsp://user:password@IP:554/1", "rtsp://user:password@IP:554/h264_stream"]) I have managed to connect with VLC player, but not with this script.., also if I define cv.VideoCapture(0), my laptop camera capturing works with no problem.

Your help is greatly appreciated.

2018-08-11 06:00:05 -0600 commented question Can't connect to cammera

Thank you, the problem was with the dill as you have mentioned, now everything works like a charm!

2018-08-10 15:15:21 -0600 asked a question Can't connect to cammera

Can't connect to cammera I'am trying to connect to my hikvision DS-2CD2032-I camera, with no success. Code: import num