You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the DirectShow VideoCaptureDevice will request RGB24 (or when available Mjpeg) MediaSubType. It would be great to be able to select the desired MediaSubType via properties. This however would be a problem if we try to convert some of the more obscure MediaSubType to Images. For this a 'raw' data mode could be added that simply passes the raw frame data as byte array instead of Image.
This would be useful for devices that have obscure MediaSubTypes or devices that send metadata within its image. E.g. thermal cameras, these often have a raw mode that sends raw sensor data instead of pixel values. That data can only be used properly if it remains in its original MediaSubType. If the original MediaSubType is e.g. YUY2 and we request RGB24, DirectShow will request YUY2 internally and convert to YUY2. This process involves rounding and is thus not reversible, rending the the data useless.
I would suggest to add two properties VideoCaptureDevice 'VideoFormat' and 'SnapshotFormat' typed with an Enum that holds different MediaSubTypes.
Since almost everything but RGB24 isn't 1:1 convertible to Image, these formats would have to be 'raw' mode only. For RGB24 and all other formats that can be converted to Image, I'd suggest for them to have an additional Enum value for when you'd like to get the raw data instead.
My idea for passing the raw data to the caller would be to extend NewFrameEventArgs with a RawData byte array property. The Frame property could be changed to be loaded 'lazy' when it is needed and would throw NotSupportedException if the data can't be converted to Image.
Please let me know if agree with my approach or if you would like to see it being done differently. I can then implement all the changes and open a pull request.
The text was updated successfully, but these errors were encountered:
Currently the DirectShow VideoCaptureDevice will request RGB24 (or when available Mjpeg) MediaSubType. It would be great to be able to select the desired MediaSubType via properties. This however would be a problem if we try to convert some of the more obscure MediaSubType to Images. For this a 'raw' data mode could be added that simply passes the raw frame data as byte array instead of Image.
This would be useful for devices that have obscure MediaSubTypes or devices that send metadata within its image. E.g. thermal cameras, these often have a raw mode that sends raw sensor data instead of pixel values. That data can only be used properly if it remains in its original MediaSubType. If the original MediaSubType is e.g. YUY2 and we request RGB24, DirectShow will request YUY2 internally and convert to YUY2. This process involves rounding and is thus not reversible, rending the the data useless.
I would suggest to add two properties VideoCaptureDevice 'VideoFormat' and 'SnapshotFormat' typed with an Enum that holds different MediaSubTypes.
Since almost everything but RGB24 isn't 1:1 convertible to Image, these formats would have to be 'raw' mode only. For RGB24 and all other formats that can be converted to Image, I'd suggest for them to have an additional Enum value for when you'd like to get the raw data instead.
My idea for passing the raw data to the caller would be to extend NewFrameEventArgs with a RawData byte array property. The Frame property could be changed to be loaded 'lazy' when it is needed and would throw NotSupportedException if the data can't be converted to Image.
Please let me know if agree with my approach or if you would like to see it being done differently. I can then implement all the changes and open a pull request.
The text was updated successfully, but these errors were encountered: