PDA

View Full Version : How can i identify which cameras image is in frameReady thread



sethupathy
October 27, 2007, 11:28:09
Hello,
I am using two cameras in single interface card simultaneously.

For that i am using a array grabber object like

m_pGrabber[1]->openDev("DFx 31AF03");
m_pGrabber[1]->setVideoFormat("UYVY (1024x768)");
m_pGrabber[1]->setFPS(15.00002);

m_pGrabber[2]->openDev("DFx 31F03");
m_pGrabber[2]->setVideoFormat("UYVY (640x480)");
m_pGrabber[2]->setFPS(15.00002);

m_pGrabber[1]->startLive();
m_pGrabber[2]->startLive();

To Starting a Frameready i use......
m_pSink->setSinkMode( GrabberSinkType::eRUN);

then....

class CListener: public GrabberListener
{
public:
virtual void frameReady( Grabber& caller, smart_ptr<DShowLib::MemBuffer> pBuffer, DWORD FrameNumber );
};

void CListener::frameReady( Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
{
BYTE *p = pBuffer->getPtr();
k=0;
for(i=Height-1; i>=0; i--)
{
for(j=0; j<Width; j++)
{
b = p[k];
k++;
g = p[k];
k++;
r = p[k];
k++;
k++;

*(*(imagearr1+i) + j) = RGB(b,g,r);
*(*(imagearr2+i) + j) = RGB(b,g,r);
}

}
}


Here now in array imagearr1 & imagearr2 which cameras image is stored?

How to get or identify two cameras images seperately?

thanks in advance.....

Sascha Schmidt
November 1, 2007, 10:30:06
Hallo sethupathy,

For example, you can identify the device in the frameReady method as follows:


std::string name = param.getDev().getName();

Also, there is a sample program attached, which uses two Listener instances.
The Listener class was extended with an Image Array as Byte*. This Image Array was set by "SetImageArr(BYTE* arr)" to an accordant array...