10/17/2011

BumBleBee 2D, 3D data acquisition source code / 범블비 2D, 3D 데이터 획득 소스

Created Date : 2009.10.
Language : C++
Tool : Visual Studio C++ 2008
Library & Utilized : Point Grey-FlyCapture, Triclops, OpenCV 2.1
Reference : PointGrey Bumblebee Reference, www.cylod.com, www.ptgrey.com/
Etc. : STL



BumBleBee Stereo Camera Data Acquisition Source code.



This is Stereo Camera. The name is BumBleBee. This is product of PointGrey Company.
This camera is IEEE 1394 capble type.
This camera can obtain 3D cloud data rapidly and continously.

I need 2 library for using this camera(Triclops SDK, FlyCapture).
You can download these libs on the www.ptgrey.com site(support).
You have to use my source after install libs. and you have to set path(To include directory, lib directory). and you also need opencv 2.1 lib.

I made the acquisition code as class. The class name is CSensorStereo2.
You can use this class like below source code.
The sequence is 'Open->GetData->Close'.
I did that 2D data save Iplimage in opencv and 3D depth data save as Txt file.
The source code is very easy to use ^^.
If you have any question, Plz give your comments to me.

Thank you.

source code is shared on Github
https://github.com/MareArts/Bumblebee_GetDataClass



#include <stdio.h>
#include "SensorStereo2.h"
#include <time.h>

void main()
{

int Width = 320;
int Height = 240; 

CSensorStereo2 CSS2;
CSS2.Initial(Width,Height); 
CSS2.Open();

cvNamedWindow("Reference");
char str[1000];

while(1) {

//get 1 frame data(Image, Depth information)
CSS2.GetData();

//Show Image
cvShowImage("Reference",CSS2.ImgReference); 

//Save Depth
sprintf(str,"./DepthData/%d_Depth.txt",time(0));
printf("%s\n", str);

FILE * fp; fp = fopen(str,"w");
for(int i=0; i<Width; ++i)
{ 
  for(int j=0; j<Height; ++j)
  {
    fprintf(fp,"%lf %lf %lf\n", CSS2.pDepth[i][j].x, CSS2.pDepth[i][j].y, CSS2.pDepth[i][j].z );
  } 
}

fclose(fp);

if(cvWaitKey(1) >= 0 )
   break;
}

cvDestroyWindow("Reference");
CSS2.Close();
}