Get error to access memory when Initialize Camera?

Post Reply
parinya.pun
Posts: 2
Joined: Thu Oct 18, 2012 5:58 am

Get error to access memory when Initialize Camera?

Post by parinya.pun »

Dear all,

I am newbie for OptiTrack. Since, I just try to make a simple code to initialize the camera using "CameraManager::X().WaitForInitialization();" the error for Access violation occur. (In the program it point to "singleton.h" of "X()" function)

I use Camera SDK 1.1.3 Final in VC2010 (x64) Windows 7. How should I do?
Unhandled exception at 0x00000001800089d1 in Test.exe: 0xC0000005: Access violation writing location 0x0000000000423a50.

Test.exe!CameraLibrary::Singleton::X() Line 58 + 0x21 bytes C++
Code is very simple but error occur from the first line :( :
CameraLibrary_EnableDevelopment();
// To access a camera is to wait for the devices to initialize.
// Then fetch a camera from the Camera Library.
CameraManager::X().WaitForInitialization();
if(CameraManager::X().AreCamerasInitialized())
printf("complete\n\n");
else
printf("failed\n\n");

OptiTrackCam = CameraManager::X().GetCamera();
if (!OptiTrackCam)
{
// Failure
}

// Camera Setting.
OptiTrackCam->SetVideoType(CameraLibrary::MJPEGMode);
OptiTrackCam->SetExposure(40);
OptiTrackCam->SetThreshold(200);
OptiTrackCam->SetIntensity(15);

// Start to sending a frames.
OptiTrackCam->Start();
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: Get error to access memory when Initialize Camera?

Post by beckdo »

Hi MOJIIZ,

I added a comment in the code to help (self-professed) noobs like yourself. I'll paste the comment here:

Code: Select all

                    //== If you are crashing here, it's likely that your solution's runtime
                    //== does not match the runtime compiled against in the Camera SDK library you're
                    //== linking into your solution.
                    //==
                    //== link the following to your project:
                    //==
                    //==     cameralibrary.lib    into your solution when you are using the static runtime (/MT)
                    //==     cameralibrarydrt.lib into your solution when you are using the dynamic runtime (/MD)
You can always use one of the samples as your starting point which links in a matching runtime library.

Let us know if this solves your problem. If not, we will work through it.
parinya.pun
Posts: 2
Joined: Thu Oct 18, 2012 5:58 am

Re: Get error to access memory when Initialize Camera?

Post by parinya.pun »

It's not working.

I have already link cameralibraryx64.lib to the linker in VC2010.
Also, try on the sample code likes SimpleCameraTest in both x86 / x64 it's work well. However, I did same things (create new project, copy all code and instance) with my new project with same code as the example, same error has occur.

I am not sure, which part that I wrong to config them, but I try to config the solution properties and I think anything is same as sample code.

.. Edit ..

Currently, I try to change runtime library (/MT, /MD) by using /MT program is work. However, the camera is not detect by the program. /MD is not working same problem as previous.

Thank you.
hisato
Posts: 1
Joined: Mon Feb 23, 2009 11:59 pm

Re: Get error to access memory when Initialize Camera?

Post by hisato »

Try to add "CAMERALIBRARY_IMPORTS" to Preprocessor Definitions.
Post Reply