where does the camera assign the object IDs.

xwy8187
Posts: 6
Joined: Fri Mar 13, 2009 1:58 am

Re: where does the camera assign the object IDs.

Post 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
Leo Kee Hao
Posts: 7
Joined: Fri Mar 20, 2009 11:37 am

Re: where does the camera assign the object IDs.

Post 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.
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: where does the camera assign the object IDs.

Post 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.
xwy8187
Posts: 6
Joined: Fri Mar 13, 2009 1:58 am

Re: where does the camera assign the object IDs.

Post 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?
Birch
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

Re: where does the camera assign the object IDs.

Post 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.
Post Reply