Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for monochrome (gray scale) camera. #46

Open
secile opened this issue Jan 7, 2025 · 3 comments
Open

support for monochrome (gray scale) camera. #46

secile opened this issue Jan 7, 2025 · 3 comments

Comments

@secile
Copy link
Owner

secile commented Jan 7, 2025

There are some issues that found problem when using monochrome (gray scale) camera.
See issue #13, #43, #45.

Until now, I have never tested monochrome camera.
In this time, I purchased monochrome camera ELP-USBGS720P02-L36.
I tested but this model works fine.

Then, I executed below and dump supported video format.

for (int i = 0; i < formats.Length; i++) Console.WriteLine("{0}:{1}", i, formats[i]);

the result is

0:[Video], [MJPG], {Width=1280, Height=720}, 166666, 60fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={1280, 720}, MinCroppingSize={1280, 720}, MaxCroppingSize={1280, 720}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={1280, 720}, MaxOutputSize={1280, 720}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=73728000, MaxBitsPerSecond=884736000, 
1:[Video], [MJPG], {Width=1280, Height=720}, 166666, 60fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={1280, 720}, MinCroppingSize={1280, 720}, MaxCroppingSize={1280, 720}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={1280, 720}, MaxOutputSize={1280, 720}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=73728000, MaxBitsPerSecond=884736000, 
2:[Video], [MJPG], {Width=800, Height=600}, 166666, 60fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={800, 600}, MinCroppingSize={800, 600}, MaxCroppingSize={800, 600}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={800, 600}, MaxOutputSize={800, 600}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=38400000, MaxBitsPerSecond=460800000, 
3:[Video], [MJPG], {Width=800, Height=600}, 166666, 60fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={800, 600}, MinCroppingSize={800, 600}, MaxCroppingSize={800, 600}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={800, 600}, MaxOutputSize={800, 600}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=38400000, MaxBitsPerSecond=460800000, 
4:[Video], [MJPG], {Width=640, Height=480}, 166666, 60fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={640, 480}, MinCroppingSize={640, 480}, MaxCroppingSize={640, 480}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={640, 480}, MaxOutputSize={640, 480}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=24576000, MaxBitsPerSecond=294912000, 
5:[Video], [MJPG], {Width=640, Height=480}, 166666, 60fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={640, 480}, MinCroppingSize={640, 480}, MaxCroppingSize={640, 480}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={640, 480}, MaxOutputSize={640, 480}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=166666, MaxFrameInterval=2000000, MinBitsPerSecond=24576000, MaxBitsPerSecond=294912000, 
6:[Video], [YUY2], {Width=1280, Height=720}, 1000000, 10fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={1280, 720}, MinCroppingSize={1280, 720}, MaxCroppingSize={1280, 720}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={1280, 720}, MaxOutputSize={1280, 720}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=1000000, MaxFrameInterval=2000000, MinBitsPerSecond=73728000, MaxBitsPerSecond=147456000, 
7:[Video], [YUY2], {Width=1280, Height=720}, 1000000, 10fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={1280, 720}, MinCroppingSize={1280, 720}, MaxCroppingSize={1280, 720}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={1280, 720}, MaxOutputSize={1280, 720}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=1000000, MaxFrameInterval=2000000, MinBitsPerSecond=73728000, MaxBitsPerSecond=147456000, 
8:[Video], [YUY2], {Width=800, Height=600}, 500000, 20fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={800, 600}, MinCroppingSize={800, 600}, MaxCroppingSize={800, 600}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={800, 600}, MaxOutputSize={800, 600}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=500000, MaxFrameInterval=2000000, MinBitsPerSecond=38400000, MaxBitsPerSecond=153600000, 
9:[Video], [YUY2], {Width=800, Height=600}, 500000, 20fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={800, 600}, MinCroppingSize={800, 600}, MaxCroppingSize={800, 600}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={800, 600}, MaxOutputSize={800, 600}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=500000, MaxFrameInterval=2000000, MinBitsPerSecond=38400000, MaxBitsPerSecond=153600000, 
10:[Video], [YUY2], {Width=640, Height=480}, 333333, 30fps, [VideoInfo], Guid=05589f80-c356-11ce-bf01-00aa0055595a, VideoStandard=0, InputSize={640, 480}, MinCroppingSize={640, 480}, MaxCroppingSize={640, 480}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={640, 480}, MaxOutputSize={640, 480}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=333333, MaxFrameInterval=2000000, MinBitsPerSecond=24576000, MaxBitsPerSecond=147456000, 
11:[Video], [YUY2], {Width=640, Height=480}, 333333, 30fps, [VideoInfo2], Guid=f72a76a0-eb0a-11d0-ace4-0000c0cc16ba, VideoStandard=0, InputSize={640, 480}, MinCroppingSize={640, 480}, MaxCroppingSize={640, 480}, CropGranularityX=1, CropGranularityY=1, CropAlignX=1, CropAlignY=1, MinOutputSize={640, 480}, MaxOutputSize={640, 480}, OutputGranularityX=1, OutputGranularityY=1, StretchTapsX=0, StretchTapsY=0, ShrinkTapsX=0, ShrinkTapsY=0, MinFrameInterval=333333, MaxFrameInterval=2000000, MinBitsPerSecond=24576000, MaxBitsPerSecond=147456000, 

It seems that sub type [MJPG] or [YUY2] works good, and some people reported me [Y8] or [Y800] or [Y16] found problem.
(to show [Y8], [Y800], [Y16], you have to register GUID for each.)

@secile
Copy link
Owner Author

secile commented Jan 7, 2025

To support monochrome camera, I need more information.
If you have found a problem when using monochrome camera, please let me know following information.

  1. product name, link to web page.
  2. result of below.
for (int i = 0; i < formats.Length; i++) Console.WriteLine("{0}:{1}", i, formats[i]);
  1. which video format you are using.
  2. what problem occurred. (do not display? exception? error?)
  3. WinForms? WPF?

@secile
Copy link
Owner Author

secile commented Feb 5, 2025

This is working note for me.

  1. some product ot TheImageSource supports Y800, Y16 format.
    e.g.) https://www.theimagingsource.com/en-us/product/industrial/23u/dfk23um021/

  2. What is GUID for Y800, Y8, Y16?
    in issue#45, rajeshamudala said

public static readonly Guid MEDIASUBTYPE_Y8 = new Guid("{17fd9d23-d15f-4e42-9e3e-310b1d4a209b}");

But as long as I googled, there is no same information.
This site said

{30303859-0000-0010-8000-00AA00389B71} (MEDIASUBTYPE_Y800)

and it seems there is a naming rule, and this matchs the rule.
https://learn.microsoft.com/en-us/windows/win32/directshow/fourccmap
I'll adopt this idea.

@secile
Copy link
Owner Author

secile commented Feb 5, 2025

continuation.

  1. I have no usb camera that suports Y800, Y8, Y16.But there is a some information about image type of Y800, Y8, Y16.
    https://www.theimagingsource.com/en-us/documentation/icimagingcontrolcpp/PixelformatY800.htm
    https://www.theimagingsource.com/en-us/documentation/icimagingcontrolcpp/PixelformatY16.htm

Y8 may be same with Y800.

so, first, I make little app that convert C# Bitmap to Y800 or Y16 image buffer, and save it to file.
and for debugging, I use the data instead of the data that comes from usb camera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant