Items with no label
3335 Discussions

Conflict in sample RF_ScenePerception while using QueryVertices()

SL4
Novice
1,547 Views

There came the read access conflict when I tried to use projection->QueryVertices() to get vertices from depth data in sample RF_ScenePerception(C++ R200).

Part of code(bold font added by myself):

void ScenePerceptionApp::Process()

{

while (!m_bTerminateProcessing)

{

PXCCapture::Sample *pSample = NULL;

float cameraPose[12] = { 0 };

if (!m_pScenePerceptionController->ProcessNextFrame(pSample, cameraPose, m_trackingAccuracy, m_fCurrentSceneQuality))

{

m_processingCallQuit = true;

return;

}

UpdateLocalImages(pSample);

PXCProjection *projection = m_pScenePerceptionController->QueryProjection();

PXCPoint3DF32 *vertices = new PXCPoint3DF32[m_iDepthWidth * m_iDepthHeight];

projection->QueryVertices(pSample->depth, vertices);

projection->Release();

......

}

}

It seems that QueryProjection() returned a null pointer while there is another *projection being used? What is the correct way to get vertices in this C++ sample?

0 Kudos
3 Replies
idata
Employee
297 Views

Hi HelloIntelWorld,

 

 

Thanks for reaching out.

 

 

To be honest, we are not sure if the issue with QueryProjection() is because you are using another projection.

 

 

Did you check the DF_Projection sample? https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?sample_projection_cpp.html, I recommend you to check that sample to know how the function is used, and use it as a reference for your code.

 

 

I hope you find this useful.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
0 Kudos
SL4
Novice
297 Views

Actually the way to use the function is the same as sample DF_Projection.

However the code in C++ samples looks very strange and unusual(for me at least). For example,

wcout << L"RF_ScenePerception: Starts." << endl;</strong>

What is common I think is cout<<"text"<<endl;</strong>

Thus I sincerely recommend you to provide a guide of how to use the "uncommon code" or add some annotations for beginner developers like me.

Well back to the topic, I have solved the problem by myself.

Before using m_pScenePerceptionController->QueryProjection() you need to initialize projection firstly. That is why QueryProjection() returned a null pointer when I tried first time.

I found InitializeProjection() in sp_controller.h. It puzzled me that the function has been declared but never used. Then I added m_pScenePerceptionController->InitializeProjection(); to initialize and used m_pScenePerceptionController->QueryProjection()->QueryVertices(pSample->depth, &myVertices[0]); in the main loop. Finally I got the vertices successfully.

Thank you a lot for your help! Hope that my work is helpful for others who need.

0 Kudos
idata
Employee
297 Views

Hi HelloIntelWorld,

 

 

That's awesome. It is good to know that you solved your issue.

 

 

We really appreciate that you have posted the solution, it definitely will be very helpful for the community, thank you so much.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.

 

0 Kudos
Reply