kekyo/FlashCap

How to capture one image

squirrelfeng opened this issue · 5 comments

I notice you removed the captureone function, could you please give a sample how to only capture one image? Thanks!

kekyo commented

@squirrelfeng I have added a new sample console application called FlashCap.OneShot for you to look at. This should suit your needs, as it is simple console-based code without any GUI fragments.

The central design is as follows:

  1. Select a device and its characteristics.
  2. Open the device and specify a callback. In the callback, use TaskCompletionSource<byte[]> to copy the first image data obtained and pass it to subsequent processing.
  3. Start capturing, wait for TaskCompletionSource<byte[]> to complete, and close it.
  4. Save the obtained image data to a file.

///////////////////////////////////////////////////////////////

kekyo commented

Added TakeOneShotAsync() in feature/32 branch. Did you want a method like this?

Thanks! Soo fast response, it worked. Appreciate your work.
If possible, I will suggest to add this function to lib.

kekyo commented

@squirrelfeng OK, I will merge to main branch :)

kekyo commented

1.5.0 is being deployed, contains this feature.