Software Archive
Read-only legacy content
17061 Discussions

Load a jpg Image in a PXCImage object

Alejandro_S_Intel1
662 Views

Hi, I am working with an application using the RealSense. In my App I need to transform a set of Images for a processing with the Emotion detector, but at this moment I haven't found the way to do that. I am using c++. I have found some ways but those need a object of the class PXCAccelerator but I can't find its library. Thank's for the help.

0 Kudos
3 Replies
olivier_a_
Beginner
662 Views

Hi, I got help from someone else to do it so I copy paste here his solution:

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_essential_image_data.html

You can get the raw image data from the OpenCV cv::Mat image, and pass it to the CreateImage method of the RealSense SDK:

//First define an ImageInfo object
PXCImage::ImageInfo info={};
info.format=PXCImage::PIXEL_FORMAT_RGB32; //Change this to match your data
//You can get these easily from an OpenCV Mat
info.width=image_width;
info.height=image_height;

 
//And now define the actual Image data
PXCImage::ImageData data={};
data.format=PXCImage::PIXEL_FORMAT_RGB32;//This should match the info object I reckon
data.planes[0]=image_buffer; //This is the critical bit. This is the actual data, the uchar array from cv::Mat
data.pitches[0]=ALIGN64(info.width*4); //This is because RGB32 is used (8bits * 4), change accordingly

// Finally Create the image instance
PXCImage *image=session->CreateImage(&info,0,&data);
0 Kudos
samontab
Valued Contributor II
662 Views

I'm someone else, and this is the original thread that olivier is referring to:

https://software.intel.com/en-us/forums/realsense/topic/606341

 

0 Kudos
Alejandro_S_Intel1
662 Views

samontab wrote:

I'm someone else, and this is the original thread that olivier is referring to:

https://software.intel.com/en-us/forums/realsense/topic/606341

 

Hi, Thank you, this could solve my first problem. My real problem is that I have a lot of images corresponding to a video generated by the realsense. But I am not able to convert them in a video cause the log file is empty. I want to use the whole bunch of images to feed a realsense application. I am running the "Emotion Viewer" on the "RealSense SDK Sample Browser". I am able to change the color image of the PXCCaptureManager, but where can I replace the depth image?. I have tested a .rsdk file and it looks like the depth PXCImage is not used in the PXCSenseManager::QueryEmotionSample()->depth. Where are used then the depth files?

0 Kudos
Reply