ustreamer icon indicating copy to clipboard operation
ustreamer copied to clipboard

Support monochrome cameras

Open gudvinr opened this issue 3 years ago • 3 comments

I have this monochrome camera: http://withrobot.com/en/camera/ocam-1mgn-u

It is quite unusual in a sense that it doesn't provide color image formats supported by ustreamer (YUYV, UYVY, RGB565, RGB24, JPEG).
Its only output pixelformat is GREY which is 8-bit monochrome image

This fact leads to ustreamer not being able to consume stream from the camera:

-- ERROR [2233.317    stream] -- Could not obtain the requested pixelformat=YUYV; driver gave us unsupported
-- ERROR [2233.317    stream] -- Unsupported pixelformat=GREY (fourcc)

$ uvcdynctrl -f output:

Listing available frame formats for device video0:
Pixel format: GREY (8-bit Greyscale)
  Frame size: 1280x960
    Frame rates: 30, 25, 15
  Frame size: 1280x720
    Frame rates: 30, 25, 15
  Frame size: 640x480
    Frame rates: 100, 90, 60, 50, 30, 25, 15
  Frame size: 320x240
    Frame rates: 180, 150, 120, 100, 60, 50

gudvinr avatar Sep 09 '22 20:09 gudvinr

Interesting. Btw can this camera generate mjpeg independently? Please show me v4l2 --list-formats. And what is the point of using this camera? Just wondering. To accept your patch, all encoders must support grayscale to avoid asserts. Otherwise, we will need some mechanism that restricts encoders for certain formats.

mdevaev avatar Sep 11 '22 14:09 mdevaev

Btw can this camera generate mjpeg independently?

No, it can't. That's basically only reason why I am asking for this.

Please show me v4l2 --list-formats.

uvcdynctrl basically does same thing, output just slightly different

what is the point of using this camera?

Point is that I have this laying around and it has global shutter and no IR filter.

To accept your patch, all encoders must support grayscale to avoid asserts. Otherwise, we will need some mechanism that restricts encoders for certain formats.

In its current state no, I just reused YUYV decoder and write luma in R, G and B channels so it still produces 24-bit data. I am okay with this but since JPEG can work with 8-bit images natively I think that should be more effective in terms of throughput and performance.

Otherwise, we will need some mechanism that restricts encoders for certain formats.

Yes, that's why I didn't do any modifications other than adding image processor. I am not familiar with project and how things work so if you have suggestion on appropriate solution for this it'd be great.

gudvinr avatar Sep 11 '22 15:09 gudvinr

Got it. I like the idea of adding this, but I have to think about how to do it right.

mdevaev avatar Sep 11 '22 17:09 mdevaev