Page 2 of 2

Re: where does the camera assign the object IDs.

Posted: Tue Mar 24, 2009 10:00 pm
by xwy8187
[quote=NaturalPoint - Birch Zimmer][quote=Wenyu]
Thanks, Can you please tell me briefly how to save the raw frame images to hard disk without image processing? [/quote]

You can use GetFrameImage() to get a buffer with the raw image data, then you can write that into a file.

For example, here is some code we used to save one frame to a PGM file. It expects pFrame to be a valid camera frame.

Code: Select all

#define IMAGE_WIDTH 640
#define IMAGE_HEIGHT 480
#define BITS_PER_PIXEL 8
#define BUFFER_FRAME_SIZE IMAGE_WIDTH * IMAGE_HEIGHT * (BITS_PER_PIXEL / 8)
#define PGM_HEADER_SIZE 15

unsigned char bufFrameCurrent[BUFFER_FRAME_SIZE];
unsigned char PGMheader[PGM_HEADER_SIZE] = {'P','5',' ', '6','4','0',' ', '4','8','0',' ', '2','5','5',' '};

pCamera->GetFrameImage(pFrame, IMAGE_WIDTH, IMAGE_HEIGHT,IMAGE_WIDTH, BITS_PER_PIXEL, (byte *) bufFrameCurrent);    

CString str_FileName;
str_FileName.Format(TEXT("OptiTrack.pgm"));

CFile tImageFile(str_FileName, CFile::modeCreate | CFile::modeWrite);

tImageFile.Write(PGMheader, PGM_HEADER_SIZE);
tImageFile.Write(bufFrameCurrent, BUFFER_FRAME_SIZE);
tImageFile.Close();
[/quote]

Thanks, but your code uses MFC, which is incompatible with windows.h, which I have included in another .h file which is included in current .cpp file

Re: where does the camera assign the object IDs.

Posted: Tue Mar 24, 2009 10:38 pm
by Leo Kee Hao
Yes, they allow C3D format. I would like to use Rigid Body instead because I do not require full body capture that is a default for ARENA.

Re: where does the camera assign the object IDs.

Posted: Wed Mar 25, 2009 8:02 pm
by Birch
[quote=lkhsp]Yes, they allow C3D format. I would like to use Rigid Body instead because I do not require full body capture that is a default for ARENA. [/quote]

ARENA is also capable of tracking rigid bodies without using a skeleton, it is less optimal than using a skeleton but it does work and is available today. We will investigate the possibility of C3D in Rigid Body/Tracking Tools, I don't know if its a feature that will happen.

Re: where does the camera assign the object IDs.

Posted: Wed Mar 25, 2009 11:40 pm
by xwy8187
Thanks, but your version is MFC, which is conflict with windows.h. Actually I am using the grayscale sample in the website. Do you have a version which can also save the frame to a file but using no MFC?

Re: where does the camera assign the object IDs.

Posted: Thu Mar 26, 2009 12:44 am
by Birch
The code we posted should be a useful reference for writing your own non-MFC function to save the image buffer to a file.