Items with no label
3335 Discussions

how can I convert PXCPoint3DF32 * to cv::Mat ?

MJala
Novice
1,129 Views

As the question suggest I am trying to convert pos3D array which is the output of QueryVertices and is in PXCPoint3DF32 * format to xyzMap which is in cv::Mat format. How should I do so?

Is this even remotely the correct way to do this?

/**

* Stores the (x,y,z) data of every point in the observable world.

* Matrix type CV_32FC3

*/

cv::Mat xyzMap;

std::vector xyzBuffer;

for (int k = 0; k < num_pixels; k++) {

 

xyzBuffer.push_back(cv::Point3f(pos3D[k].x, pos3D[k].y, pos3D[k].z));

 

}

xyzMap = cv::Mat(xyzBuffer);

0 Kudos
1 Solution
idata
Employee
254 Views

Hi MonaJalal,

 

 

Thanks for reaching out!

 

 

Personally, I have not done a conversion like that, however, I have been investigating and I found information that you may find useful. First, I'd recommend you to watch this video: https://www.youtube.com/watch?v=wIkIdjN6Oyw https://www.youtube.com/watch?v=wIkIdjN6Oyw, there you'll find an explanation of how to convert RealSense images to OpenCV images. In addition to that, in this other site: https://software.intel.com/en-us/forums/realsense/topic/544860 Realsense ImageData to OpenCV Mat, you can find a snippet code to convert a color image to OpenCV image. I believe you can use that information as a reference to reach what you need.

 

 

I hope you find this information useful.

 

 

Regards,

 

-Yermi A.

 

View solution in original post

0 Kudos
1 Reply
idata
Employee
255 Views

Hi MonaJalal,

 

 

Thanks for reaching out!

 

 

Personally, I have not done a conversion like that, however, I have been investigating and I found information that you may find useful. First, I'd recommend you to watch this video: https://www.youtube.com/watch?v=wIkIdjN6Oyw https://www.youtube.com/watch?v=wIkIdjN6Oyw, there you'll find an explanation of how to convert RealSense images to OpenCV images. In addition to that, in this other site: https://software.intel.com/en-us/forums/realsense/topic/544860 Realsense ImageData to OpenCV Mat, you can find a snippet code to convert a color image to OpenCV image. I believe you can use that information as a reference to reach what you need.

 

 

I hope you find this information useful.

 

 

Regards,

 

-Yermi A.

 

0 Kudos
Reply