StillsCSharp outputting 16 bit TIFF

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

paulcarson

  • Posts: 6
  • Joined: Wed Aug 07, 2019 1:51 pm
  • Real Name: Paul Carson

StillsCSharp outputting 16 bit TIFF

PostWed Aug 07, 2019 3:48 pm

Hi,

I need to capture some 16 bit TIFF images from a DeckLink Mini Recorder and SDK StillCSharp seems a good place to start.
I tried changing line 611 to "PixelFormat.Format64bppArgb" but the TIFF file has no data.
Novice at image aquisition & DirectShow so any help greatly appreciated.
Thanks,
Paul
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 217
  • Joined: Mon Sep 04, 2017 4:05 am

Re: StillsCSharp outputting 16 bit TIFF

PostThu Aug 08, 2019 2:51 am

Hi Paul,

By design the StillsCSharp SDK sample uses PixelFormat.Format32bppArgb as it mirrors DeckLinkAPI pixel format _BMDPixelFormat.bmdFormat8BitBGRA. This allows a System.Drawing.Bitmap object to be created from the IDeckLinkVideoFrame buffer without memory copy.

Regards
Cameron
Offline

paulcarson

  • Posts: 6
  • Joined: Wed Aug 07, 2019 1:51 pm
  • Real Name: Paul Carson

Re: StillsCSharp outputting 16 bit TIFF

PostThu Aug 08, 2019 6:12 am

Thanks Cameron, does the API not support 16 RGB, if it does is the System is limited?
I’m trying to capture 10 bit RGB data as my camera is outputting a 10 bit ramp greyscale test pattern that I need to analyse. Saving the capture as a 16 bit file is not my preferred option, ideally I’d actually like to store the raw image in arrays and analyse within the GUI and output some results.
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 217
  • Joined: Mon Sep 04, 2017 4:05 am

Re: StillsCSharp outputting 16 bit TIFF

PostFri Aug 09, 2019 2:02 am

Hi Paul,

No the DeckLinkAPI does not support 16-bit deep color - a list of supported pixel formats can be found in the DeckLink SDK Manual[1].

You will probably want to capture with pixel format bmdFormat10BitRGB. You can access the (unmanaged) buffer by calling IDeckLinkVideoFrame::GetBytes[2] on your incoming frame. You would probably then use Marshal.Copy to copy into a managed array (keep in mind the processing time for this operation). The length of array is found by multiplying the frame height by the bytes per row [3][4].

Regards
Cameron

References (DeckLink SDK Manual):
[1] 2.7.4 Pixel Formats
[2] 2.5.5.6 IDeckLinkVideoFrame::GetBytes method
[3] 2.5.5.2 IDeckLinkVideoFrame::GetHeight method
[4] 2.5.5.3 IDeckLinkVideoFrame::GetRowBytes method
Offline

paulcarson

  • Posts: 6
  • Joined: Wed Aug 07, 2019 1:51 pm
  • Real Name: Paul Carson

Re: StillsCSharp outputting 16 bit TIFF

PostFri Aug 09, 2019 8:57 am

thanks again Cameron,

when I run StillCSharp it only allows the 8 bit or 10 bit YUV formats to be selected. I'm assuming that the DeckLink Mini Recorder therefore does not output bmdFormat10BitRGB natively and the YUV must be transcoded to RGB?
Perhaps I do not need to go that far as I'm only working with greyscale I could just use the Y component?
I'll have a go at coding it and see what data I get.

BTW I plan to capture 20 frames into an array and then do some minor analysis (Mean, STdev) so I don't think timing will be an issue...
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 217
  • Joined: Mon Sep 04, 2017 4:05 am

Re: StillsCSharp outputting 16 bit TIFF

PostMon Aug 12, 2019 1:29 am

Hi Paul,

Yes the DeckLink Mini Monitor supports only 8-bit and 10-bit YUV capture. To capture in RGB, you should use the IDeckLinkVideoConversion interface to convert the captured frame to the required format. The StillsCSharp sample demonstrates how to achieve this by creating a class that implements IDeckLinkVideoFrame, and using this as the output of IDeckLinkVideoConversion.ConvertFrame() method - see Bgra32VideoFrame.cs.

But as you said, if you are only interested in greyscale, then it would be best to work from YUV. Keep in mind that you are dealing with video range levels (64 to 940).

Regards
Cameron
Offline

paulcarson

  • Posts: 6
  • Joined: Wed Aug 07, 2019 1:51 pm
  • Real Name: Paul Carson

Re: StillsCSharp outputting 16 bit TIFF

PostFri Aug 16, 2019 9:03 pm

Hi Cameron,
thanks, after learning a little about OO and multithreading Ive now got 16bit TIFFs without stretching.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 5 guests