hadi hadi
hadi hadi

Reputation: 11

i need help for use ip camera in python and open cv

my original code for cam is

import cv2.cv as cv
import time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

while True:
    img = cv.QueryFrame(capture)
    cv.ShowImage("camera", img)
    if cv.WaitKey(10) == 27:
        break
cv.DestroyAllWindows()

what I change,,not the ip for camera is 20.0.0.14

Upvotes: 1

Views: 622

Answers (1)

Rahul K P
Rahul K P

Reputation: 16081

Find out your camera model from the list https://www.ispyconnect.com/sources.aspx . And change the code like this. I assumed that using HoneyWell Camera.

import cv2

capture = cv2.VideoCapture("http://IPADDRESS/axis-cgi/mjpg/video.cgi")

while True:
    img,ret = capture.read()
    cv2.imshow("camera", img)
    if cv.WaitKey(10) == 27:
        break
cv2.destroyAllWindows()

Upvotes: 1

Related Questions