LoginSignup
0

More than 1 year has passed since last update.

IDSカメラをPythonで制御するためのパラメータ

Last updated at Posted at 2022-06-24

諸事情でIDS ueyeカメラ(UI3250)をPythonから制御したい。
ライブ画像を表示するスクリプトは公式からダウンロードできる(ログイン必要)。
露光時間・フレームレートを調整しようとして詰まったが、下記を書き加えるとどうやら制御できた。

Python
from pyueye import ueye
import ctypes

pixel_clock = ueye.uint(30) #10-128
nRet = ueye.is_PixelClock(hCam, ueye.IS_PIXELCLOCK_CMD_SET, pixel_clock, ueye.sizeof(pixel_clock))

time_exposure = ueye.double(20) #ms
nRet = ueye.is_Exposure(hCam, ueye.IS_EXPOSURE_CMD_SET_EXPOSURE, time_exposure, ueye.sizeof(time_exposure))

targetFPS = float(10) #fps
actualFPS = ueye.double()
nRet = ueye.is_SetFrameRate(hCam, targetFPS, actualFPS)

#露光時間・フレームレートを表示
print("Exposure time:\t", time_exposure)
print("Frame rate:\t", actualFPS)

参考

追記

なぜかimport ctypesを消すと制御できない?
単純にOpenCVでaviを保存すると意図したフレームレートよりもっと多くのフレームが取得されている。要検討。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0