PDA

View Full Version : Capture from two cameras simultaneously



trekman
March 27, 2012, 16:13:43
I am working on a multispectral camera that requires capturing images from two cameras simultaneously. I have just started working on this project and am just looking for the best way to capture images from two cameras.

Stefan Geissler
March 27, 2012, 16:27:04
Hello

Best way is using an external trigger pulse.

trekman
April 26, 2012, 16:48:10
One other issue I was having was how to control the image settings of both cameras. I want them both to be the same, and thus I want to use one control for both for things like gamma, gain, etc. How to I control both camera's settings from one control?

Stefan Geissler
April 27, 2012, 08:10:46
Hello,


I want them both to be the same, and thus I want to use one control for both for things like gamma, gain, etc. How to I control both camera's settings from one control?

You simply create the slider controls on your form. I the slider change event, you pass the new value of the property to both ActiveX controls. You only need to know both ActiveX controls in your slider event handlers. But I guess, you have one form and both IC Imaging Control ActiveX on it. So you know them.

trekman
May 1, 2012, 17:41:51
Thank you for all your help,

Just a few more questions...

1)
I am using two DFK 31AF03's and I want to get simultaneous capture from them at 30fps. However I am essentially getting a "not enough bandwidth" error, as I can get it to work at 7.5fps. Is there a way to get the 30fps capture from both cameras?

2)
I am having trouble actually saving two video files to the computer. Do I create two different sinks? Then how do I get them both to capture at the same time?

Thanks,

Stefan Geissler
May 2, 2012, 09:41:12
1)
I am using two DFK 31AF03's and I want to get simultaneous capture from them at 30fps. However I am essentially getting a "not enough bandwidth" error, as I can get it to work at 7.5fps. Is there a way to get the 30fps capture from both cameras?

As expected, FireWire controllers have a limited bandwidth. Therefore, simply install a second FireWire controller.


2)
I am having trouble actually saving two video files to the computer. Do I create two different sinks? Then how do I get them both to capture at the same time?


Yes, you have to create all twice, since you have two cameras. As soon as the live video started, both will save the two AVI files.

trekman
May 3, 2012, 07:09:09
Thanks,

I'm stil having issues capturing from two cameras though.

I have written the following function which is triggered on a start button. The stop button function simple calls m_Grabber1.stopLive(), and m_Grabber2.stopLive().

This only generates one .avi file and the file doesn't play. What am I doing wrong here?


void CVCDSimplePropertyDlg::OnCaptureStart()
{
m_Grabber1.stopLive();
m_Grabber2.stopLive();


tMediaStreamContainerListPtr pContainerList =
MediaStreamContainer::getAvailableMediaStreamConta iners();

smart_ptr<MediaStreamSink> pSink;
smart_ptr<MediaStreamSink> pSink2;

//AVI select
tMediaStreamContainerPtr pCont = pContainerList->at( 0 );


GUID fmt_id = s_UncompressedFormatList[2].id;

pSink = MediaStreamSink::create( pCont, fmt_id );

pSink2 = MediaStreamSink::create( pCont, fmt_id );
}

pSink->setFilename( "test.avi" );

pSink2->setFilename( "test2.avi" );

m_Grabber1.setSinkType( pSink );
m_Grabber2.setSinkType( pSink2 );

m_Grabber1.startLive();
m_Grabber2.startLive();

pSink2->setSinkMode(GrabberSinkType::eRUN );
pSink->setSinkMode(GrabberSinkType::eRUN );

}

Stefan Geissler
May 3, 2012, 10:56:04
Hi

First of all, I am a little bit surprised you use C++, because you posted in the ActiveX forum.

However: You need all twice.

Declarations:


DShowLib::Grabber m_cGrabber1; // The instance of the Grabber class.
DShowLib::Grabber m_cGrabber2; // The instance of the Grabber class.
smart_ptr<DShowLib::MediaStreamSink> m_pSink1;
smart_ptr<DShowLib::MediaStreamSink> m_pSink2;
DShowLib::tMediaStreamContainerListPtr m_pContainerList1;
DShowLib::tMediaStreamContainerListPtr m_pContainerList2;
DShowLib::tMediaStreamContainerPtr m_pCont1;
DShowLib::tMediaStreamContainerPtr m_pCont2;


and working with them:


m_pContainerList1 = MediaStreamContainer::getAvailableMediaStreamConta iners();
m_pContainerList2 = MediaStreamContainer::getAvailableMediaStreamConta iners();
m_pCont1 = m_pContainerList1->at( 0 );
m_pCont2 = m_pContainerList2->at( 0 );

m_pSink1 = MediaStreamSink::create(m_pCont1, MEDIASUBTYPE_RGB24 );
m_pSink2 = MediaStreamSink::create(m_pCont2, MEDIASUBTYPE_RGB24 );

m_pSink1->setFilename( "test1.avi" );
m_pSink2->setFilename( "test2.avi" );

m_cGrabber1.setSinkType( m_pSink1 );
m_cGrabber2.setSinkType( m_pSink2 );


Now you can start both streams. I suppose, you got an cryptic exception error text, telling, that the pin is already connected, right? Then you aborted your program. In this case, the header file of the first, working AVI file was not written, with the results, it is not playable.

trekman
May 8, 2012, 05:07:10
Thank you so much! That did solve the problem. I now get two avi files. One question though. the first file seems to be the correct length, but the second file is less than a second long. Is there any reason for this, and can I get them both to record similar times?

Stefan Geissler
May 8, 2012, 09:07:49
Hello

If both cameras show a nicely running live image, then there is no reason, why only one video is captured, except the computer or the hard disc are too slow.

With the sample above, I had no problem capturing both videos, but I use a current, fast computer.