有没有一种方法可以使用python触发动作摄影机

2024-05-17 04:34:39 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试使用廉价的动作摄像机制作一个时间点-型号:现代cnu3000

我的第一次攻击是将其用作网络摄像头,并使用一个简单的opencv脚本获取IMG:

import cv2

cap = cv2.VideoCapture(0)

# reseting resolution to max it out 
# since opencv has a default of 640X480
cap.set(3,3000)
cap.set(4,3000)

while(True):
    ret, frame = cap.read()

    # Display the resulting frame
    cv2.imshow('frame',frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        # save when using 'q' key
        cv2.imwrite("testing_webcam.jpg", frame)
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

此重新搜索分辨率为(1280X720)的图像 这是摄像机的最大“视频录制”分辨率——这是有意义的,因为我们正在向计算机直播(实际上是raspberry pi,但windows pc也工作得很好)

现在,事情是这样的——令人惊讶的是,这款相机能够以更高的分辨率拍摄图像(2592X1944) 但仅当我手动使用时(即按下按钮,从而保存到sd卡)。 我不介意保存到sd卡,但我想知道是否有一种方法可以在不使用流媒体的情况下触发相机-获得更高的分辨率

用我的Pi试过gphoto——正如预期的那样,不起作用(我在supported model list中没有找到这个模型)

pi@raspberrypi:~ $ gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Mass Storage Camera            disk:/media/pi/7AFB-BDAE
pi@raspberrypi:~ $ gphoto2 --trigger-capture

*** Error ***              
This camera can not trigger capture.
ERROR: Could not trigger capture.
*** Error (-6: 'Unsupported operation') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
...
...
...

如有任何帮助/指点方向,将不胜感激


Tags: theto图像releasepi分辨率sdcv2