View Full Version : How to process two cameras simultaneously?
selvanathan
October 27, 2007, 07:10:02
Dear Sir,
How can i process two cameras simultaneously? I am using running image process.
I am sending you a sample program which contains single camera - running image process, like the same way how i can use two cameras simultaneously.
plz... help me..
thanks in advance
selvanathan
November 2, 2007, 11:37:30
Hello Sir,
Is there anything wrong or not clear in my question?. Usually i got a replys with in a day. but this time i am not getting reply till now(6 days) . I need u r valuable reply urgently... plz help me...
Sascha Schmidt
November 2, 2007, 14:29:44
Hallo selvanathan,
Sorry for late response.
Here is a modified version of your project, including simultaneously image processing with two cameras:
selvanathan
November 5, 2007, 06:14:39
Dear Sir,
Thank you very much for your reply. Its very much useful for me. Thank u very much again....
Stefan Geissler
November 5, 2007, 11:18:13
Hi Selvanathan,
I would like you to not provide any license keys in your samples. Thank you very much.
Thus I removed your attachments.
selvanathan
November 6, 2007, 06:52:06
Hello Stefan,
No problem.... Sorry, here after i am not use license key in a sample programs. Thank u.
selvanathan
November 6, 2007, 10:00:17
Dear Stefan,
I have another 2 doubts,
Doubt 1:
from the previous forums you know that i am using 2 cameras...,
from your sample program i am altering that code for my cameras like below
for Camera 1:
m_pGrabber_Cam1->openDev("DFx 31F03");
m_pGrabber_Cam1->setVideoFormat("UYVY (1024x768)");
m_pGrabber_Cam1->setFPS(15.00002);
for Camera 2;
m_pGrabber_Cam2->openDev("DFx 31AF03");
m_pGrabber_Cam2->setVideoFormat("UYVY (1024x768)");
m_pGrabber_Cam2->setFPS(15.00002);
But i got error ( see.. error message in attachment....)
in case i change the video format like
m_pGrabber_Cam1->setVideoFormat("UYVY (1024x768)");
m_pGrabber_Cam2->setVideoFormat("Y800 (1024x768)");
now the error not comes... how i keep camera 1 and camera 2's video format same...
Doubt 2:
like the same .... when using 2 cameras .....
inside frameready i need to process that...
camera one's image to gray scale.... and
camera two's image to edgedetuction.....
suppose i create two functions.....
DoImageProcessing_1( pBuffer); // this Apply gray scale to image
DoImageProcessing_2( pBuffer); // this Apply edge detuction to image
then how i identify which cameras buffer image is available currently in pBuffer and call above functions that i need..
void CListener_Cam1::frameReady( Grabber& param, smart_ptr<MemBuffer> pBuffer, DWORD FrameNumber)
{
pBuffer->lock();
if( camera 1) // what i do here
DoImageProcessing_1( pBuffer);
else
DoImageProcessing_2( pBuffer);
DrawBuffer(pBuffer);
pBuffer->unlock();
}
i need your valuable reply soon...
thanks in advance.....
Stefan Geissler
November 6, 2007, 13:53:21
Hi Selvanathan,
Please refer to following link:
http://www.theimagingsource.com/en/resources/whitepapers/download/fwcamsbandwwp.en.pdf
This document contains a list of FireWire bandwidth allocation depending on video formats and frame rates.
UYVY needs 2 bytes per pixel, Y800 only one. Thus you should use a lower frame rate, e.g.7.5 fps in order to get both cameras running with UYVY video format.
Pointing to "Doubt 2:"
This is very simple. You have created your CListener object twice:
CListener_Cam1 mp_Listener1;
CListener_Cam1 mp_Listener2;
m_pGrabber_Cam1->addListener(&mp_Listener1);
m_pGrabber_Cam2->addListener(&mp_Listener2);
Your CListener_Cam1 class needs only a member, that receives the information which camera is in use, e.g. int "TheCamera". This must be set:
mp_Listener1.TheCamera = 1;
mp_Listener2.TheCamera = 2;
selvanathan
November 7, 2007, 04:52:36
Dear Stefan,
Thank you... Thank You very much for u r reply.... Its very usful for me.. Doubt 2 is fully clear.. and i got what i need...
I under stood u r reply for doubt 1:
But I need to run both cameras in UYVY video format with 15 FPS
I am not able to change following points... all are very important for me....
1. Video Format - UYVY
2. Image Size - 1024 x 768
3. FPS - 15 (Min)
4. I should process continuous running images
To get all the above what i need to do.....or i need to change any system specifications
Plz... help me..... thanks in advance...
selvanathan
November 13, 2007, 06:22:09
Dear Stefan,
Please help me to solve the above problem.... i tried in all the way but i am not able to connect both the cameras with above options.. so .. plz.. reply me .... as soon as possible.....
thanks in advanvce.......
Stefan Geissler
November 13, 2007, 09:44:20
Hi,
Did you read the bandwidth PDF file? I gave the link to you. It says:
UYVY 1024x768 15 fps = 77% bandwidth allocation.
You may use two FireWire boards?
selvanathan
November 13, 2007, 10:09:33
Dear Stefan,
Thank u very much for u r reply... i am very sorry .. i read u r pdf link.. but i under stood partially... now i under stood ... thank u very much again.
Stefan Geissler
November 13, 2007, 13:11:31
Do you want to use two FireWire boards in your computer? This would fix your problem.
selvanathan
November 15, 2007, 04:02:17
Ok Sir Thank u very much
selvanathan
December 14, 2007, 13:25:10
Dear Stefan,
I alreay got a sample program from you for simeltaneously processing 2 cameras. Its working fine.. but i noticed that in windows task manager->Performance->CPU Usage is 100%.... why it takes 100% and how to decrease it.
and also i noticed that it happens when the buffer values transfered to array..
in frameready...
void CListener_Cam1::frameReady( Grabber& param, smart_ptr<MemBuffer> pBuffer, DWORD FrameNumber)
{
pBuffer->lock();
DrawBuffer(pBuffer);
pBuffer->unlock();
}
if i use above code CPU Usage takes only maximum of 33%.. but if i use like following ........
void CListener_Cam1::frameReady( Grabber& param, smart_ptr<MemBuffer> pBuffer, DWORD FrameNumber)
{
pBuffer->lock();
DoImageProcessing( pBuffer); // For Processing Image
DrawBuffer(pBuffer);
pBuffer->unlock();
}
void CListener_Cam1::DoImageProcessing( smart_ptr<MemBuffer> pBuffer)
{
smart_ptr<BITMAPINFOHEADER> pInf = pBuffer->getBitmapInfoHeader();
BYTE* pImageData = pBuffer->getPtr();
int iImageSize = pInf->biWidth * pInf->biHeight * pInf->biBitCount / 8 ;
//////// It Increases CPU Usage ///////////////////
for( int i = 0; i < iImageSize; i++)
{
pImageData[i] = 255 - pImageData[i];
}
//////// It Increases CPU Usage ///////////////////
}
it takes 100% CPU Usage........
Also I attached sample program for your reference.....
Plz Note:
I removed ImageSource Dlls & Lib to reduce file size and
I remove licence key as per u r advice in previous forums.
Stefan Geissler
December 14, 2007, 13:48:02
Hi,
If you add some more imageprocessing, then the computer has more to do. That increases the CPU load. I will have a look later on your project.
Stefan Geissler
December 14, 2007, 14:45:03
Hi,
On my old computer using only one DFK 21AU04 with no image processing, the CPU load is at 90%.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.