6 Replies Latest reply on Aug 22, 2017 3:49 AM by MartyG

    R200 Processing and Camera Streams


      Hi, I am creating a sketch in Processing and seem to have some issues around the PXCMImage.ImageData.ToPImage class.


      My code looks as such...




      import intel.rssdk.*;


      PXCMSenseManager sm = null;

      //int nframes = 0;

      PImage imgDepth;


      void setup() {

        size(640, 480);


      // Create a SenseManager instance

      PXCMSenseManager sm=PXCMSenseManager.CreateInstance();


      // Select the color and depth streams





      // Initialize and Stream Samples


      for (;;) {

         // This function blocks until both samples are ready

         if (sm.AcquireFrame(true).isError()) break;


         // retrieve the samples

         PXCMCapture.Sample sample=sm.QuerySample();



         // work on the samples: sample.color & sample.depth

      // ...

         if (sample.depth != null) {

             PXCMImage.ImageData dData = new PXCMImage.ImageData();

             sample.depth.AcquireAccess(PXCMImage.Access.ACCESS_READ,PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, dData);

            // imgDepth = dData.ToPImage(0, imgDepth);

            // PXCMImage.ImageData.ToPImage(0, imgDepth);







        //hoping to convert the PXCMImage data to something drawable in canvas. String fail

        //String depth=sample.depth;





         // go fetching the next samples









      void draw() {

            //need to get data from sample.depth here. 

            image("imgDepth", 0, 0);






      // Close down

      void dispose(){





      I can see the camera is initialized, and that it is filling up data in memory by using the print line, but  ToPImage does not seem to work as expected.


      Another method is a previous sample was

            // imgDepth = dData.ToPImage(0, imgDepth);

      but also no luck that, or even getting the sample to work correctly



      I am sure it is something quite simple that I am overlooking due to being new to Processing / Java. If anyone has any insights that would truly be appreciated.


      Best, and thank you!