Choose highest possible color depth format from camera

Hi all

How can I choose the highest color depth format from the camera using ofVideoGrabber?

I’m currently doing camera.setPixelFormat(OF_PIXELS_YV12); but I’m not sure if it really is 12bit color (grayscale) depth. I basically need higher resolution in color values (more than 8bit 0-255)


Any help is greatly appreciated!

This is the current capture code:

#include "lsCapture.h"

void lsCapture::setup(ofxXmlSettings *_settings) {
	settings = _settings;
		settings->getValue("settings:captureSettings:captureDeviceId", 0));
		settings->getValue("settings:captureSettings:captureW", 640), 
		settings->getValue("settings:captureSettings:captureH", 480));

void lsCapture::update() {
	if (camera.isFrameNew()) {
		newFrameMat = ofxCv::toCv(camera.getPixels().getPlane(0));
		ofLogNotice() << newFrameMat;

void lsCapture::draw() {
	camera.draw(0, 0);

And this is what I get as output in console when run:

[notice ] ofGstVideoGrabber: initGrabber(): selected device: See3CAM_CU30
[notice ] ofGstVideoGrabber: initGrabber(): selected format: 640x480 video/x-raw UYVY framerate: 30/1
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: v4l2src name=video_source device=/dev/video0 ! video/x-raw,format=UYVY,width=640,height=480,framerate=30/1 ! videoconvert ! appsink name=ofappsink enable-last-sample=0 caps=“video/x-raw, format=YV12, width=640, height=480”

The problem is, the newFrameMat only seems to contain values up to 255 instead of 4096 which I expected from YV12… or am I wrong?

See3CAM_CU30 camera supports UYVY and MJPEG formats and it doesn’t support YV12. But YV12 in itself is not a 12bit grayscale format and it is a planar display format. If you are interested in 12bit grayscale output, please refer our See3CAM_CU51 -