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();
}















 

24 comments:

  1. Hi Mare,
    I'm looking for your CSensorStereo2 header and C++ files. Could you share them with me?
    I'm very intersting in using BumbleBee with Triclops and OpenCV ...
    Thank you!
    Greg

    ReplyDelete
  2. Hi Gregouze.
    I have uploaded the source code on the Google-Doc.
    However, somehow the link is not working propertly.
    So I am going to send the file to your email.
    Regards.

    ReplyDelete
  3. hello,

    I would be intrested in using the opencv libraries with bumblebee and I think this code could be a good starting point. Can I please ask you to share the files with me. Thank you

    ReplyDelete
  4. Dear Valentin
    I have sent the example source code to your email.
    Please check the your email.
    Thank you for visit my blog.

    ReplyDelete
  5. Anonymous9/2/12 09:23

    Hello
    I am interested in using the disparities of bumblebee stereo camera in the real time .Can you please hep me in doing this
    Thanx

    ReplyDelete
  6. Ok. What is your problem?
    If you want the source code, I can help you easily.
    Please give me your email address to my email(feelmare@gmail.com) or left comment on this post again.
    I will send the source code by email.
    Thank you for visit my blog.

    ReplyDelete
  7. Hi Mare,
    I'm looking for your CSensorStereo2 header and C++ files too. Could you share them with me (kke0217@gmail.com)?
    I'm very intersting in using BumbleBee with Triclops and OpenCV ...
    Thank you!
    KwangEun Ko.

    ReplyDelete
    Replies
    1. Dear Kwang-Eun Ko
      I have sent the source file to your email.
      I sorry to reply too lately.
      Please check your email.
      Thank you for visiting my blog.

      Delete
  8. Anonymous30/4/12 05:12

    Hi Mare, thanks for sharing your code first.
    I would like to show frames acquired from both cameras but i didn't manage it. You wrote:

    cvShowImage("Reference",CSS2.ImgReference);

    and can actually see just one image.
    Which camera is this image coming from?

    ReplyDelete
  9. I think.. The reference image in the bumblebee is right camera.
    But I cann't be sure. I don't remember.
    But you can check. Cover the lense by your hand one by one.
    And
    If you want to get other camera, move to the "GetData" function in the CSensorStereo2 Class.
    And find "triclopsGetImage16" function.
    and change TriCam_REFERENCE to LEFT_IMAGE.

    Now I cann't check source code. because there is not bumblebee in here.
    Anyway, you can get wanted camera data by changing option "TriCam_REFERENCE", "LEFT_IMAGE", "RIGHT_IMAGE"
    Thank you.

    ReplyDelete
  10. Anonymous3/5/12 01:21

    Unfortunately setting the option to TriCam_LEFT doesn't work, it returns a windows with generic red, blue and green pixel bands. I think it is caused by the imageType TriImg16_DISPARITY in the function triclopsGetImage16. I've tried also using the triclopsGetImage:

    if ( triclopsGetImage( triclops, TriImg_RAW, TriCam_LEFT, &refImage ) != TriclopsErrorOk )
    return false;
    cvShowImage("Reference1",refImage.data); <-------..but this gives runtime error

    ReplyDelete
  11. Sorry.
    I don't have bumblebee camera now.
    To get bumblebee, I should visit to my university
    Or I can ask to my junior in university.
    Please wait..
    Thank you.

    ReplyDelete
  12. Anonymous8/5/12 04:16

    I've solved by contacting the PTG Support
    Thank you

    ReplyDelete
    Replies
    1. Hi Anonymous,

      I have same problem like your problem. I would like to show COLOR LEFT RAW IMAGE and COLOR LEFT RECTIFIED IMAGE from BumbleBee2 camera. But i didn't get COLOR LEFT IMAGEs. Please can you say me how to solve this problem?

      I am looking forward your answer.

      Thank you.

      Delete
  13. Hello Mare,

    I'm very intersting in using BumbleBee with Triclops and OpenCV. Please, could you please share your source code with me? Please, can you help me for my Ph.D. thesis?

    Thank you!

    ReplyDelete
    Replies
    1. This is link address.
      https://docs.google.com/file/d/0B7Z5A9fd6h29OTcwNzExNTktN2QxNS00OWRkLThjOTEtNTU0ZWNhOTdjZDYz/edit?hl=ko
      and You also download source code on the page.

      Delete
    2. Hi,

      Thank you for your interested.

      I downloaded and run it. But i created new empty project at VC++ 2012. And i copied your codes into my new empty project but i didn't run it. I have error that is "0xc0150002". I didn't understand. But When i compiled my new project, there is no compiler error and warning and it create an EXE file.

      I hope, i have explained my problem.

      i am looking forward your answers.

      Thank you.

      Delete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hi I am a beginner in with Bumble bee, I was following your code. The code was very much helpful.
    However I have the following doubt.

    How to take the left and right images? I understand that the raw data comes as a 16 bit image. So after you have created 'ReferanceImgae', I tried to right bit shift the colorImage.blue, colorImage.red and colorImage.green by 8 bits and create the second Image. [SensorStereo2.cpp lines 296-298]

    I tried this:
    Left:

    ImgReference->imageData[ i*ImgReference->widthStep+j*3+0] = (unsigned char) colorImage.blue[k];
    ImgReference->imageData[ i*ImgReference->widthStep+j*3+1] = (unsigned char) colorImage.green[k];
    ImgReference->imageData[ i*ImgReference->widthStep+j*3+2] = (unsigned char) colorImage.red[k];

    Right:

    ImgReference2->imageData[ i*ImgReference2->widthStep+j*3+0] = (unsigned char) (colorImage.blue[k]>>8);
    ImgReference2->imageData[ i*ImgReference2->widthStep+j*3+1] = (unsigned char) (colorImage.green[k]>>8);
    ImgReference2->imageData[ i*ImgReference2->widthStep+j*3+2] = (unsigned char) (colorImage.red[k]>>8);


    But I was not able to see that. What I get is a black window.
    What could have went wrong? Could you please help me?

    ReplyDelete
    Replies
    1. Hi.Mike~~
      I just doing the vision serving in using BumbleBee2 .
      Do you have the CSensorStereo2 header and C++ files mentioned above?
      I am just looking for that file~~
      Can you send it to me?
      My email is yunong7379@gamil.com
      Thanks a lot!

      Delete
  16. Hi mike, now I don't have bumblebee camera, so I cannot test your code.
    But if you wait about 1 month, I will buy bumblebee by 3 lens type,
    Then I will update the source code more useful.
    Thank you for visiting my blog.

    ReplyDelete
  17. Hello Mare..
    nice work...
    i'm also interested in using bumblebee cam and opencv..,
    i try to run your code, but I get this: How to solve this error LNK2019?
    thanks.. you can email me : rostam.ftk@gmail.com....


    1>SensorStereo2.obj : error LNK2019: unresolved external symbol _triclopsSetSubpixelInterpolation referenced in function "public: bool __thiscall CSensorStereo2::Open(void)" (?Open@CSensorStereo2@@QAE_NXZ)
    1>SensorStereo2.obj : error LNK2019: unresolved external symbol _triclopsSetUniquenessValidation referenced in function "public: bool __thiscall CSensorStereo2::Open(void)" (?Open@CSensorStereo2@@QAE_NXZ)
    1>SensorStereo2.obj : error LNK2019: unresolved external symbol _triclopsSetTextureValidation referenced in function "public: bool __thiscall CSensorStereo2::Open(void)" (?Open@CSensorStereo2@@QAE_NXZ)
    1>SensorStereo2.obj : error LNK2019: unresolved external symbol _triclopsSetDisparity referenced in function "public: bool __thiscall CSensorStereo2::Open(void)" (?Open@CSensorStereo2@@QAE_NXZ)

    ReplyDelete
  18. Hi Mare,
    I'm looking for your CSensorStereo2 header and C++ files. Could you share them with me?
    I'm doing the vision serving in using BumbleBee2 with Triclops and OpenCV ...
    Thank you!

    ReplyDelete
    Replies
    1. Here is entire source code.
      https://github.com/MareArts/Bumblebee_GetDataClass

      Thank you.

      Delete