Using GUID to permanently set camera number/position
Posted: 23 January 2010 03:28 PM   [ Ignore ]
Jr. Member
Avatar
RankRank
Total Posts:  40
Joined  2009-12-28

Hi guys,

I am connecting 4 cameras, I want to permanently assign each camera a specific camera number using their unique GUID number, so everytime i plug in the the 4 cameras each camera will be initialized in the correct order and assigned to the correct camera number/window.

The base code i’m using is the CLEyeMultiCamTest c++ example.

The relevant part of the main function that sets up each connected camera based on GUID is as follows:

for(int i 0numCamsi++)
    
{
        char windowName[64]
;

        
// Query unique camera uuid
        
GUID guid CLEyeGetCameraUUID(i);
        
printf("Camera %d GUID: [x-x-x-xxxxxxxx]\n"
                        
i+1guid.Data1guid.Data2guid.Data3,
                        
guid.Data4[0]guid.Data4[1]guid.Data4[2],
                        
guid.Data4[3]guid.Data4[4]guid.Data4[5],
                        
guid.Data4[6]guid.Data4[7]);
    
        
sprintf(windowName"Camera Window %d"i+1); 

        
// Create camera capture object
        // Set Color video, vga quality and fps
        
cam[i] = new CLEyeCameraCapture(windowNameguidCLEYE_COLORCLEYE_VGA30);

        
printf("Starting capture on camera %d\n"i+1);
        
cam[i]->StartCapture();
    

What would the best method of storing my 4 cameras GUID numbers and initilizing each new camera capture in the correct order?

I have tried various methods, including getting rid of the for loop and setting up each camera capture object manually but i wasn’t successfull when trying to compare GUID numbers!

Hope you can help and point me in the right direction:-)

Cheers,
Alan

 Signature 

“Strive for perfection in everything you do. Take the best that exists and make it better. When it doesn’t exist, design it, build it and Open Source it!” http://www.alangunning.com

Profile
 
 
Posted: 23 January 2010 04:46 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  585
Joined  2009-09-17

Alan, you would simply define an array of camera GUIDs either statically or loaded from a file.
Something like this:

GUID cameraGuid[] 

    { 0x00000000
0x00000x0000{ 0x000x000x000x000x000x000x000x00 } },    // camera 0
    
{ 0x000000000x00000x0000{ 0x000x000x000x000x000x000x000x00 } },    // camera 1
    
{ 0x000000000x00000x0000{ 0x000x000x000x000x000x000x000x00 } },    // camera 2
    
{ 0x000000000x00000x0000{ 0x000x000x000x000x000x000x000x00 } },    // camera 3
};

for(
int i 0numCamsi++)
{
    char windowName[64]
;

    
// Assign unique camera GUID from the array
    
GUID guid cameraGuid[i];
    
printf("Camera %d GUID: [x-x-x-xxxxxxxx]\n"
                        
i+1guid.Data1guid.Data2guid.Data3,
                        
guid.Data4[0]guid.Data4[1]guid.Data4[2],
                        
guid.Data4[3]guid.Data4[4]guid.Data4[5],
                        
guid.Data4[6]guid.Data4[7]);
    
    
sprintf(windowName"Camera Window %d"i+1); 

    
// Create camera capture object
    // Set Color video, vga quality and fps
    
cam[i] = new CLEyeCameraCapture(windowNameguidCLEYE_COLORCLEYE_VGA30);

    
printf("Starting capture on camera %d\n"i+1);
    
cam[i]->StartCapture();

In the array simply put the GUIDs of your cameras in order you want them being created and initialized.

AlexP

Profile
 
 
Posted: 24 January 2010 11:13 AM   [ Ignore ]   [ # 2 ]
Jr. Member
Avatar
RankRank
Total Posts:  40
Joined  2009-12-28

But of course grin

I knew there had to be an easy way, got it working thanks to you grin

Alex thanks very much for being so helpful, i’m very grateful for it!

I hope that I will be able to give back to the community soon too.

take care,

Alan

 Signature 

“Strive for perfection in everything you do. Take the best that exists and make it better. When it doesn’t exist, design it, build it and Open Source it!” http://www.alangunning.com

Profile
 
 
 
 


RSS 2.0     Atom Feed