Items with no label
3335 Discussions

C# QueryInvUVMap: Data Unavailable

jb455
Valued Contributor II
1,210 Views

Hi,

Using C# , I'm trying to colour each frame of my colour stream according to the depth data. So if there's no depth data the pixel will be black, otherwise leave it as it is. The reason I'm not using the built-in CreateColorImageMappedToDepth method is because that is centered on the depth image, while I need it to be centered on the colour image.

So, I'm using the InvUVMap (as used in the C++ projection sample) to get the depth data for each of the colour points, but in around 10% of the frames, QueryInvUVMap returns STATUS_DATA_UNAVAILABLE and I have to drop that frame, resulting in a very jerky video stream. Is there anything I can do to make this function call more reliable?

Also, when running the stream while calling this function each frame, the memory usage is ever-increasing, and the Garbage Collector has to run pretty much every frame (if I don't call it but continue to render the normal colour stream the memory usage stays about constant and GC runs about every 10 seconds). Is it possible that there's a memory leak there? I'm disposing of the PXCMProjection object and releasing the image access etc every frame, is there anything else I need to do to get rid of the UVMap?

Thanks,

James

0 Kudos
6 Replies
idata
Employee
322 Views

Hi James,

 

 

Thank you for contacting us.

 

 

Let us investigate more about this, I'll let you know when I have updates.

 

 

Have a nice weekend.

 

 

Regards,

 

-Leonardo
0 Kudos
idata
Employee
322 Views

Hi James,

 

 

I just want to let you know that we are still investigating about this.

 

 

I appreciate your patience.

 

 

Regards,

 

-Leonardo
0 Kudos
jb455
Valued Contributor II
322 Views

Thanks Leonardo, any help would be much appreciated.

0 Kudos
idata
Employee
322 Views

Hi James,

 

 

We want to know if you looked at the function "DepthToColorByQueryInvUVMap" in the file RSSDK\sample\DF_Projection\src\main.cpp for guidance on how to handle this situation. If you didn't please check it and let us know if it was helpful.

 

 

We will be waiting for your response.

 

 

Regards,

 

-Leonardo
0 Kudos
jb455
Valued Contributor II
322 Views

Hi Leonardo,

I did look at that: that's where I got the idea to do what I'm attempting from. Whilst running that C++ sample through debug though, I've never had QueryInvUVMap return STATUS_DATA_UNAVAILABLE, nor have I seen the memory increase as much as it does in C# .

My next question was going to be on how to translate all the pointer stuff (lines 114-120) in that sample method to C# . Because I couldn't work out how to translate it I ended up using ImageData.ToIntArray to get at the image buffer, setting the pixels to 0 if there's no depth data, then ImageData.FromIntArray to write back to the image buffer, which isn't as time efficient as the pointer stuff. Maybe that's causing the issues I'm seeing? If my fiddling with the image buffer takes more than 1/30th of a second (the stream rate) and a frame is missed, QueryInvUVMap will error on the next frame?

Thanks,

James

0 Kudos
idata
Employee
322 Views

Hi James,

I'm not sure how it should work in C# , normally in these cases with custom codes we bring the tools to help the user to develop his code because it is beyond our scope of support. But we encourage you to continue with it, and post your results to help the community.

We really appreciate your participation in the community.

Regards,

 

-Leonardo
0 Kudos
Reply