forums.naturalpoint.com

Discussion and Support for the OptiTrack, SmartNav and TrackIR brands by NaturalPoint

Visual C++ .net

by avelazquez » Wed Jun 30, 2010 7:36 am

I will like to thank in advance anyone willing to help me; I am trying to get the image displayed in a picturebox using DrawFrame, I am having a hard time figuring out how to get the picture handle. I am using Visual C++ .net, below is a portion of the code I'm using.

waittime = 10; // value in milliseconds; 0 = don't wait; INFINITE = wait till data
running = 6000; // run ~1 minute for waittime=10 ms

while(running--) //!TimeToClose
{
pCamera->GetFrame(waittime, &pFrame);
?//pCamera->DrawFrame(pFrame, pictureBox1);
pFrame->Free();
}

// shut everything down
pCamera->Stop();
pCamera->Close();

CoUninitialize();
avelazquez
 
Posts: 19
Joined: Mon Jun 07, 2010 7:40 am

by Birch » Wed Jun 30, 2010 3:09 pm

If you have an ID for the picturebox you can use the following example (which draws over a GroupBox frame).

pCamera->DrawFrame(pFrame, (LONG) GetDlgItem(IDC_STATIC_FRAME_IMAGE)->GetSafeHwnd());

Which assumes :
GROUPBOX "",IDC_STATIC_FRAME_IMAGE,147,3,240,340



Also, if there is an issue with the picture box allowing the SDK to paint the image on top of it, then you could alternately try GetFrameImage (search this forum for more posts about that)
Birch
NaturalPoint Employee
NaturalPoint Employee
 
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon


Return to OptiTrack SDK