PDA

View Full Version : Image Processing from 2 cameras



Daniel983
December 5, 2007, 16:50:34
Hi
In my application of image processing I need now to appliy the same operations to the two images coming from the to cameras simultaneously.
I've write this code but it doesn't seems work fine: it isn't simultaneous and the operation are applied at the same data istead of different data for different application.
How i can do?

The code:
Grabber grabber;
Grabber grabber2;

CListener *pListener = new CListener();
CListener *pListener2 = new CListener();


if( !setupDeviceFromFile( grabber ) )
{
return -1;
}
if( !setupDeviceFromFile( grabber2 ) )
{
return -1;
}

grabber.addListener( pListener, GrabberListener::eFRAMEREADY);
grabber2.addListener( pListener2, GrabberListener::eFRAMEREADY);

FrameTypeInfoArray acceptedTypes=FrameTypeInfoArray::createStandardTy pesArray();

// Create the frame handler sink

smart_ptr<FrameHandlerSink> pSink = FrameHandlerSink::create( acceptedTypes , 50 );
smart_ptr<FrameHandlerSink> pSink2 = FrameHandlerSink::create( acceptedTypes , 50 );

pSink->setSnapMode( false );
pSink2->setSnapMode( false );

grabber.setSinkType( pSink );
grabber2.setSinkType( pSink2 );

std::cin.get();

if( !grabber.prepareLive( false ) )
{
std::cerr << "grabber.prepareLive failed: " << grabber.getLastError() << std::endl;
return -1;
}

if( !grabber2.prepareLive( false ) )
{
std::cerr << "grabber.prepareLive failed: " << grabber.getLastError() << std::endl;
return -1;
}

grabber.startLive(false);
grabber2.startLive(false);

std::cin.get();

grabber.stopLive();
grabber2.stopLive();

grabber.removeListener( pListener );
grabber.removeListener( pListener2 );

delete pListener;
delete pListener2;

std::cin.get();

return 0;
}


Thanks!!
__________________
DL

Stefan Geissler
December 5, 2007, 16:56:00
Hi Daniel,

I would like to see your listener class too. I am not able to find an error in your program code. But I would use:
smart_ptr<FrameHandlerSink> pSink = FrameHandlerSink::create( eRGB24, 50 );
smart_ptr<FrameHandlerSink> pSink2 = FrameHandlerSink::create( eRGB24, 50 );

This has no relation to your problem.

Daniel983
December 5, 2007, 17:13:06
I do not use eRGB24 because my camera supports only Y800 format and in the image proccessing I convert the frames in Ipl images to work with OpenCv.

Anyway where i can post you my listener class?

bye bye

Stefan Geissler
December 5, 2007, 17:15:10
Hi Daniel,

then use "eY800" instead.

You can send your listener to support@imagingcontrol.com.