ビデオキャプチャデバイスの設定
このセクションでは、PropertyMap インターフェースを使用してビデオキャプチャデバイスを設定する方法を示す、簡単なサンプルプログラムを紹介します。
デバイスプロパティへのアクセス の記事では、プロパティクラスの機能について詳しく解説しています。
デバイスを開く
ここではデモンストレーションとして、利用可能な最初のビデオキャプチャデバイスを開きます。
// Create a grabber object
var grabber = new ic4.Grabber();
// Open the first available video capture device
var firstDevInfo = ic4.DeviceEnum.Devices.First();
grabber.DeviceOpen(firstDevInfo);
解像度の設定
次に、デバイスの出力を Mono8 データ、ROI を 640x480 に設定します。
// Configure the device to output images in the Mono8 pixel format
grabber.DevicePropertyMap.SetValue(ic4.PropId.PixelFormat, ic4.PixelFormat.Mono8);
// Set the resolution to 640x480
grabber.DevicePropertyMap.SetValue(ic4.PropId.Width, 640);
grabber.DevicePropertyMap.SetValue(ic4.PropId.Height, 480);
ROI 原点の設定
次に、ROI の原点をセンサーの左上隅へ移動します。
// Set the origin of the ROI to the top-left corner of the sensor
grabber.DevicePropertyMap.SetValue(ic4.PropId.OffsetAutoCenter, "Off");
grabber.DevicePropertyMap.SetValue(ic4.PropId.OffsetX, 0);
grabber.DevicePropertyMap.SetValue(ic4.PropId.OffsetY, 0);
露光時間の設定
最後に、デバイスの露光時間を 5ms に固定し、自動ゲイン制御を有効にします。
// Configure the exposure time to 5ms (5000µs)
grabber.DevicePropertyMap.SetValue(ic4.PropId.ExposureAuto, "Off");
grabber.DevicePropertyMap.SetValue(ic4.PropId.ExposureTime, 5000.0);
// Enable GainAuto
grabber.DevicePropertyMap.SetValue(ic4.PropId.GainAuto, "Continuous");


