Items with no label
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
3340 Discussions

QueryPersonData() causes 'System.AccessViolationException' occurred in libpxcclr.cs.dll

Yaniv_S_Intel
Employee
2,256 Views

Hi all,

I'm trying to retrieve a personData from bodyTracking module using R200 camera.

I have a while senseManager acquire frames loop and in it I'm using a personTrackingData ptd and querying it to get the Person instance:

...

...

...

while (sm.AcquireFrame(true).IsSuccessful())

{

Thread.Sleep(1000);

// ptm is a PXCMPersonTrackingModule instance

PXCMPersonTrackingData ptd = ptm.QueryOutput();

PXCMPersonTrackingData.Person p = ptd.QueryPersonData(PXCMPersonTrackingData.AccessOrderType.ACCESS_ORDER_BY_ID, 0);

// Get the data

tracker.numberOfPeople = ptd.QueryNumberOfPeople();

tracker.trackingState = ptd.GetTrackingState();

person.presonID = p.QueryTracking().QueryId();

person.pointInfo = p.QueryTracking().QueryCenterMass().world;

printData(person, tracker);

// Resume next frame processing

sm.ReleaseFrame();

}

// Clean up

sm.Dispose();

...

...

...

On the marked line I get an unhandled exception of type 'System.AccessViolationException' occurred in libpxcclr.cs.dll error.

(Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.)

I read a bit in this issue and saw that it could be caused by using 2 instances of SenseManagers running and using the same resources from 2 threads.

I don't know what it's have to do with QueryPersonData() function I call.

Anyone has an idea that can help me solve this problem?

Yaniv

0 Kudos
5 Replies
MartyG
Honored Contributor III
762 Views

I am not personally experienced with Person Tracking programming. However, when comparing your code to an example script in the Person Tracking documentation, I observed that on the last line, the documentation uses

sm->Release();

whilst your script uses sm.Dispose(); So maybe you could try changing Dispose to Release.

0 Kudos
idata
Employee
762 Views

Hi Yaniv,

Did you try MartyG's suggestion? Did it work?

Please let us know if you still have issues.

Have a nice weekend.

Regards,

 

Leonardo R.
0 Kudos
Yaniv_S_Intel
Employee
762 Views

Yes I solve it myself by adding a condition before the function call.

I put an if statement - querying the number of people being tracked.

If the number is greater than 0, than I called ptd.QueryPersonData function.

Yaniv.

0 Kudos
MartyG
Honored Contributor III
762 Views

Glad you found a solution! Good luck with the rest of your project.

0 Kudos
idata
Employee
762 Views

Hi Yaniv,

 

 

That's great! Thank you so much for letting us know.

 

 

Feel free to contact us when you have doubts.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
0 Kudos
Reply