【问题标题】:How can i connect ethernet connected camera through python (Flir AX8 camera)如何通过 python 连接以太网连接的相机(Flir AX8 相机)
【发布时间】:2019-06-28 07:15:50
【问题描述】:

我正在尝试通过 python 连接 Flir AX8 相机。此摄像头连接到笔记本电脑的以太网端口。所以,VideoCapture() 无法识别端口,我已经尝试了它的所有索引(0、1、2),但它没有连接。谁能帮我把相机连接到python?

我尝试通过VideoCapture(1)VideoCapture('IP address') 进行连接

使用 IP 地址:

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

使用索引 0、1、2:

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

在这两种情况下我都会遇到以下错误:

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'

【问题讨论】:

  • 那么用什么协议来发送数据呢?您是否只想保存相机中视频流的屏幕截图?您是否正在积极尝试通过其 API 控制相机
  • 我正在使用这台相机来寻找物体的位置。该摄像机通过 FLIR IP CONFIG 连接。软件。
  • 你读过它关于如何configure the server?的说明
  • 是的,但没有帮助。

标签: python camera ethernet


【解决方案1】:

导入 cv2 将 numpy 导入为 np

当真时: cap=cv2.VideoCapture('http://admin:admin@169.254.253.219/snapshot.jpg?user=admin&pwd=admin&strm=0') ret,img=cap.read() cv2.imshow('视频输出',img) k=cv2.waitKey(1) 如果 k==ord('q'): 打破

cap.release() cv2.destroyAllWindows

【讨论】:

  • 你拯救了我的一天。时间。
猜你喜欢
  • 2012-04-27
  • 2022-01-12
  • 1970-01-01
  • 2012-10-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多