help with drawframe

Post Reply
maister
Posts: 20
Joined: Fri Dec 18, 2009 10:12 am

help with drawframe

Post by maister »

Hello!!!
I`m new using Optitrack cameras. I`m doing project and I want that camera images show in form panel. This is my code:


pCamera->Start();
INPCameraFrame * pCameraFrame;
pCamera->GetFrameById(1, &pCameraFrame);
pCamera->DrawFrame(pCameraFrame,this->panel1->Handle.ToInt32());

pCamera is INPCamera * pCamera and panel1 is System.Windows.Forms.Panel

when I try to run, the program return a box message with the next error message:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at optitracks.Camera.Create(INPCamera* pCamera) in c:\documents and settings\user\desktop\optitracks\optitracks\camera.cpp:line 14
at optitracks.Form1.InitializeData() in c:\documents and settings\user\desktop\optitracks\optitracks\form1.h:line 141
at optitracks.Form1.button1_Click(Object sender, EventArgs e) in c:\documents and settings\user\desktop\optitracks\optitracks\form1.h:line 153
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I'm using visual 2005 and the project is in windows forms

any idea?? can you help me??

thanks!!
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: help with drawframe

Post by beckdo »

I haven't tried displaying camera images by passed a winforms panel although I'm sure it's possible. You might consider utilizing the GetFrameImage call to pull the image data and display it yourself. Check the samples for how to do that.
Post Reply