I am trying to connect a Flir AX8 camera through python. This camera is connected to the ethernet port of the laptop. So, the VideoCapture()
isn't recognising the port, I've tried all indexes for it (0, 1, 2), but it doesn't connect. Can anyone help me that how can i connect the camera to python?
I have tried connecting through VideoCapture(1)
and through VideoCapture('IP address')
import cv2, time
video=cv2.VideoCapture('http://admin:admin@IP address/')
a=0
while True:
a=a+1
check, frame = video.read()
print(check)
print(frame)
#gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Capturing",frame)
key=cv2.waitKey(1)
if key== ord('q'):
break
print(a)
video.release()
cv2.destroyAllWindows
import cv2, time
video=cv2.VideoCapture(1)
a=0
while True:
a=a+1
check, frame = video.read()
print(check)
print(frame)
#gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Capturing",frame)
key=cv2.waitKey(1)
if key== ord('q'):
break
print(a)
video.release()
cv2.destroyAllWindows
I am getting following error in both situations:
False
None
Traceback (most recent call last):
File "C:\Users\yashw\Desktop\ex.py", line 15, in <module>
cv2.imshow("Capturing",frame)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
import cv2 import numpy as np
while True: cap=cv2.VideoCapture('http://admin:admin@169.254.253.219/snapshot.jpg?user=admin&pwd=admin&strm=0') ret,img=cap.read() cv2.imshow('videos output',img) k=cv2.waitKey(1) if k==ord('q'): break
cap.release() cv2.destroyAllWindows