I have been trying to locally (connected with ethernet cable) open an Axis Camera M1054 using OpenCv under Python. I'm working under Windows 7 - 64. I have been using this code with the Axis Camera as the only camera connected :
import sys
import cv2
import numpy as np
capture = cv2.VideoCapture(0)
if not capture.isOpened():
print "Error opening capture device"
capture.release()
cv2.destroyAllWindows()
if capture.isOpened():
print "Device captured correctly",capture
while 1:
ret, frame = capture.read()
print "frame1 =",frame
if ret == False :
print "frame is None"
break
cv2.imshow('Camera 1',frame)
if cv2.waitKey(100) == 0x1b:
print 'ESC pressed. Exiting ...'
break
capture.release()
cv2.destroyAllWindows()
All I get from it is a black screen and all the matrixes displayed thanks to
print "frame1 =",frame
are full of 0.
I've also tried to call the camera using
cv2.VideoCapture(http://169.254.167.2/axis-cgi/mjpg/video.cgi?resolution=352x240?.mjpg)
But I'm still getting the same result.
It's also important to notice that even if it only display black image and null matrixes, the computer asks me for the camera credentials when I run the code.
I've been looking for a solution but nothing seems to work (I've also tried to get the live video with Windows Media Encoder before and then to call it with
cv2.VideoCapture(0)
But didn't get any better result. Has someone already faced this problem ?