TheImagingSource / ic4-examples

IC4 Example Programs
Apache License 2.0
5 stars 3 forks source link

How to set relative properties through C# #21

Open Skullface9512 opened 1 month ago

Skullface9512 commented 1 month ago

I'm working on debugging the camera by C#, but i don't know how to set its camera properties, such as exposure time and gain, and if i want to take a specified number of photos, what should i modified in here.

TIS-Edgar commented 1 month ago

The example you link shows you how to set properties. You can simply copy the lines and modify the property IDs and values like so:

propertyMap.SetValue(ic4.PropId.ExposureAuto, "Off");
propertyMap.SetValue(ic4.PropId.ExposureTime, 3000.0);

propertyMap.SetValue(ic4.PropId.GainAuto, "Off");
propertyMap.SetValue(ic4.PropId.Gain, 30.0);

An overview over available property IDs can be found in our documentation: https://www.theimagingsource.com/en-us/documentation/ic4dotnet/api/ic4.PropId.html

If you want to only save a limited amount of images you should modify the while loop that fires TriggerSoftware to stop after the image count you need.