View Full Version : Could i get 2 unique numbers from 2 same model cameras

June 19, 2008, 11:01:47
Hello setphan
How r u ? i ask u a doubt after a long time.... my doubt is..

i need a function like GetUniqueNumber() [ this is for example] . Suppose i call this function that will return a unique number from my camera.

For Example i have 2 cameras with same model DFx 21AF04

now i connect DFx 21AF04 (Camera 1) and call the function

GetUniqueNumber() - it must return a value X

now i remove the present camera and connect another DFx 21AF04 (Camera 2) and call the same function

GetUniqueNumber() - now it must return a value X

simply my requirement is i wrote a vc++ program for DFx 21AF04 camera... suppose i remove that camera and fix another DFx 21AF04 camera there.. the program must not work....

is this possible??????:confused:

thanks in advance

Sascha Schmidt
June 19, 2008, 13:09:47
Hallo selvanathan,

there exists the method 'VideoCaptureDeviceItem::getUniqueName()'.
This method returns a string with the unambiguously name of the device.
This string is composed from the name and the serial number of the device.

So, if I understand you correctly and you want that your application works only with one camera:
Simply compare .getUniqueName() with the unique name of your favorite camera...

June 20, 2008, 05:22:32
Hello Sascha,
Thank u for your reply. I think your reply exactly match my requirement. i will test and return back to u...... if need..

September 26, 2008, 10:05:30
Dear sir,

now only i check with getUniqueName().......

i use like this

CWnd* handle1 = GetDlgItem(IDC_LIVEIMAGE);

m_pGrabber = new DShowLib::Grabber();
ASSERT( m_pGrabber );
m_pListener = new CListener_VTest();
ASSERT( m_pListener );
m_pGrabber->addListener( m_pListener, GrabberListener::eFRAMEREADY);
m_pListener->SetViewCWnd( handle1 );
m_pSink = FrameHandlerSink::create( PIXEL_FORMAT, NUM_BUFFERS );
m_pSink->setSnapMode( false );
m_pGrabber->setSinkType( m_pSink );

m_pGrabber->setWindowSize(r.right, r.bottom);

m_pGrabber->openDev("DFx 31AF03");
m_pGrabber->setVideoFormat("Y800 (1024x768)");

__int64 iSerial;
m_pGrabber->getDev().getSerialNumber( iSerial );


but i dont know how to get unique number and how i check with my unique number..

help me.. to complete....

thanks in advance...

Stefan Geissler
September 26, 2008, 13:40:13
Hello Selvanathan,

the getUniqueName() function returns a string:

std::string UniNum = m_pGrabber->getDev().getUniqueName();

Now the unique number is saved in the string UniNum. It contains the name of the camera and serial number.

As you know, IC Imaging Control appends a running number to the device name, if more than one device is connected:
DFK 21AF04
DFK 21AF04 1
DFK 21AF04 2

This extra running number is not in the unique name.

September 29, 2008, 04:59:26
dear Stefan,
thank u for u r reply.... it's working fine..