Stream product monochrome image with color camera

Hi all,

I’m using Dalsa Nano C2420 with third generation acqusition interface.

When I use the Dalsa with GenICam Browser, I can snap and save color 24 pictures that I’m looking for, but when I use it into my c++ code, I only have monochrome pictures.

Can somebody help me ? ^^

There is my code :slight_smile: :

m_cvbDevice = new_device;	
if (m_cvbDevice == nullptr || !m_cvbDevice)
	throw std::exception("cannot acces device, my_genICame_device_ptr is nullptr");
if (m_cvbDevice->ConnectionState() == Cvb::ConnectionState::NotSupported)
	throw std::exception("device not supported");
if (m_cvbDevice->ConnectionState() != Cvb::ConnectionState::Connected)
	throw std::exception("device not connected");
m_imageStream = m_cvbDevice->Stream<Cvb::CompositeStream>(); 

if (m_imageStream == nullptr)
	return new CImageNew();

Cvb::CompositePtr composite;
Cvb::WaitStatus status;
Cvb::NodeMapEnumerator nodeMaps;
m_imageStream->Start();
std::tie(composite, status, nodeMaps) = m_imageStream->Wait();
m_imageStream->Abort();

auto multiImagePart = Cvb::MultiPartImage::FromComposite(composite);
int count = multiImagePart->PlanesCount();
auto part = multiImagePart->GetPartAt(0);
if (!Cvb::holds_alternative<Cvb::ImagePtr>(part))
	;//TODO manage error
else
{
	auto image = Cvb::get<Cvb::ImagePtr>(part);
	image->Save(L"P:\\Library\\test\\cvb_image_from_multipart.bmp");
	auto plane = image->Plane(0);
	auto dataType = plane.DataType();
	auto linearAccess = image->Plane(0).LinearAccess();
	auto buffer = linearAccess.BasePtr();
	{
        size_t bufferIndex = 0;
       CImageColor24 image(imagePtr->Width(), imagePtr->Height());
       for (size_t index = 0; index < imagePtr->PlanesCount(); index++) {
	    unsigned char* plane = imagePtr->Plane(index).LinearAccess().BasePtr();
	    size_t imagePixelCount = imagePtr->Width() * imagePtr->Height();
	    for (size_t ii = 0; ii < imagePixelCount; ii++) {
		image[bufferIndex][0] = plane[ii];
		image[bufferIndex][1] = plane[ii];
		image[bufferIndex][2] = plane[ii];
		bufferIndex++;
	    }
       }
    }
}

Hi @AxelDosSantosDoAlto,

the old (2nd Gen Acquisition Stack) using the GenICam.vin driver had the converters integrated including the decoding of bayer patterns from color cameras.

The new GenTL Acquisition Stack which you use does not include the decoding of bayer patterns.
We plan to release a separate PixelFormatConverter Class as part of the Image Manager with the next Major Release of CVB 14.1 with which you can convert the acquired images to different formats including decoding of bayer raw images.
I can´t give you a potential release date yet.

In the meantime, you need to use the BayerToRGB tool which is part of the Foundation Package. Unfortunately, this needs an additional / updated license of an Image Manager or CameraSuite License.

For a limited time you can use 30 day trial licenses to get forward with your application.

Hi @Sebastian,

Thanks for your reply.
Well is it possible that I wrote it myself (during my wait for your new version) ?

Axel

You have already access to the raw image data with linear access. You can decode the bayer raw image on your own, use an algorithm you find somewhere and integrate it or use our BayerToRGB Tool from the Foundation Package.

Thanks fo your reply. I will do that and change it for the new CVB release when it will go to the market.