0

I would like to access a panasonic CCTV camera, and to begin with I'm trying to use a basic code (such as the following for a webcam):

import cv2
import numpy as np

cap = cv2.videoCapture(0)

while True:
   ret, frame = cap.read()
   cv2.imshow('frame', frame)
   if cv2.waitKey(1) == ord('q'):
         break

cap.release()
cv2.destroyAllWindows()

In order to change the camera, do I change the VideoCapture command?

I saw that for IP cameras I have to put a URL instead of 0. Is it the same in this case?

I'm using: pyhon 2.7.15, openCV 2.4.9, windows 7

The camera's manual is: https://panasonic.cn/support/download/manual/files/WV-BP330%E3%80%81332%E3%80%81334.pdf

Thanks a lot

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
c.habar
  • 9
  • 1
  • 4
  • Panasonic makes quite a few different models of cameras with varying features. Do you have some specific one in mind? Please, elaborate, details matter. – Dan Mašek Sep 16 '18 at 12:18
  • I think you must use it like in this answer https://stackoverflow.com/a/18411168/4510954 – ElConrado Sep 16 '18 at 19:46
  • Thank you. I am trying to use a WV-BP330 camera. I am adding the manual of the camera, since I'm really not sure what details are relevant to the problem. – c.habar Sep 17 '18 at 07:19
  • https://panasonic.cn/support/download/manual/files/WV-BP330%E3%80%81332%E3%80%81334.pdf – c.habar Sep 17 '18 at 07:19
  • Also, ElConrado, I looked at the link and didn't quite understand whether the code is meant to record a video or to use an existing one. Or it doesn't matter? If you could add an explanation, it would be much appreciated :) – c.habar Sep 17 '18 at 07:36

2 Answers2

3

Put the URL of the video feed in VideoCapture argument in this way:

cv2.VideoCapture(url)
Aksen P
  • 4,564
  • 3
  • 14
  • 27
Bivek Gyawali
  • 116
  • 2
  • 9
1

this is working for me on Hikvision camera

import cv2
cap = cv2.VideoCapture('rtsp://admin:hik12345@10.199.27.123:554')
while True:
    ret, img = cap.read()
    cv2.imshow('video output', img)
    k = cv2.waitKey(10)& 0xff
    if k == 27:
        break
cap.release()
cv2.destroyAllWindows()
Paul Peter
  • 31
  • 3
  • 1
    Hi and thanks for the answer, however this seems to be a pretty big code block with no explanation! Please consider adding an explanation on what this code does and why it is working compared to the OP's code. – Simas Joneliunas Sep 20 '21 at 23:42