<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [Processing][Java] toPimage fails with Segmentation output. in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097538#M67414</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I just picked up a laptop with an F200 in it, and am working on a quick tech demo for the camera.&lt;/P&gt;

&lt;P&gt;I am working in the Processing IDE right now, for quick iteration. But will move this directly to
java after the demo. I am combining Segmentation with basic face tracking to create a consistent green
screen effect during head movement.&lt;/P&gt;

&lt;P&gt;The problem comes up in the following part of the code: (Full source linked in gist at end.)&lt;/P&gt;

&lt;PRE class="brush:java;"&gt;
PXCM3DSeg segmentation = senseMgr.Query3DSeg();

if (segmentation != null) {
  
     PXCMImage segmentedImage = segmentation.AcquireSegmentedImage();
     
     if (segmentedImage != null) {
       PXCMImage.ImageData dData = new PXCMImage.ImageData();
       segmentedImage.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, dData);
       //imgDepth = dData.ToPImage(0, imgDepth);
       segmentedImage.ReleaseAccess(dData);
       image(imgDepth, 0, 0);
     } else {
       println("null segImage"); 
     }
     
} else {
   println("null seg"); 
}
&lt;/PRE&gt;

&lt;P&gt;
Everything runs perfectly with that line commented. But if I uncomment it, I get about 4 frames of Seg data (with a lot of
artifacting in the bottom.) then the following crash:
&lt;/P&gt;

&lt;PRE&gt;
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006495c250, pid=10424, tid=4980
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [msvcr100.dll+0x3c250]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\username\Downloads\processing-2.2.1-windows64\processing-2.2.1\hs_err_pid10424.log
#
# If you would like to submit a bug report, please visit:
#   &lt;A href="http://bugreport.sun.com/bugreport/crash.jsp" target="_blank"&gt;http://bugreport.sun.com/bugreport/crash.jsp&lt;/A&gt;
#
&lt;/PRE&gt;

&lt;P&gt;&lt;SMALL&gt;I can provide the error report file if necessary&lt;/SMALL&gt;&lt;/P&gt;

&lt;P&gt;Again, nothing ever crashes until I start to call 'toPimage'&lt;/P&gt;

&lt;P&gt;Unfortunately I don't see a way to get at the source of toPimage to see if it is an issue due to the alpha channel?
Is there source available for the Processing library? Is there a workaround to not use toPimage that you would recommend?&lt;/P&gt;

&lt;P&gt;To reproduce this, here is the current full source: &lt;A href="https://gist.github.com/BorisKourt/8ac77261731000be2fb6#file-trackingandremoval-pde-L86" target="_blank"&gt;https://gist.github.com/BorisKourt/8ac77261731000be2fb6#file-trackingandremoval-pde-L86&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Any help/source/workarounds would be supremely appreciated!&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2016 20:44:09 GMT</pubDate>
    <dc:creator>Boris_K_</dc:creator>
    <dc:date>2016-03-03T20:44:09Z</dc:date>
    <item>
      <title>[Processing][Java] toPimage fails with Segmentation output.</title>
      <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097538#M67414</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I just picked up a laptop with an F200 in it, and am working on a quick tech demo for the camera.&lt;/P&gt;

&lt;P&gt;I am working in the Processing IDE right now, for quick iteration. But will move this directly to
java after the demo. I am combining Segmentation with basic face tracking to create a consistent green
screen effect during head movement.&lt;/P&gt;

&lt;P&gt;The problem comes up in the following part of the code: (Full source linked in gist at end.)&lt;/P&gt;

&lt;PRE class="brush:java;"&gt;
PXCM3DSeg segmentation = senseMgr.Query3DSeg();

if (segmentation != null) {
  
     PXCMImage segmentedImage = segmentation.AcquireSegmentedImage();
     
     if (segmentedImage != null) {
       PXCMImage.ImageData dData = new PXCMImage.ImageData();
       segmentedImage.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32, dData);
       //imgDepth = dData.ToPImage(0, imgDepth);
       segmentedImage.ReleaseAccess(dData);
       image(imgDepth, 0, 0);
     } else {
       println("null segImage"); 
     }
     
} else {
   println("null seg"); 
}
&lt;/PRE&gt;

&lt;P&gt;
Everything runs perfectly with that line commented. But if I uncomment it, I get about 4 frames of Seg data (with a lot of
artifacting in the bottom.) then the following crash:
&lt;/P&gt;

&lt;PRE&gt;
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006495c250, pid=10424, tid=4980
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [msvcr100.dll+0x3c250]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\username\Downloads\processing-2.2.1-windows64\processing-2.2.1\hs_err_pid10424.log
#
# If you would like to submit a bug report, please visit:
#   &lt;A href="http://bugreport.sun.com/bugreport/crash.jsp" target="_blank"&gt;http://bugreport.sun.com/bugreport/crash.jsp&lt;/A&gt;
#
&lt;/PRE&gt;

&lt;P&gt;&lt;SMALL&gt;I can provide the error report file if necessary&lt;/SMALL&gt;&lt;/P&gt;

&lt;P&gt;Again, nothing ever crashes until I start to call 'toPimage'&lt;/P&gt;

&lt;P&gt;Unfortunately I don't see a way to get at the source of toPimage to see if it is an issue due to the alpha channel?
Is there source available for the Processing library? Is there a workaround to not use toPimage that you would recommend?&lt;/P&gt;

&lt;P&gt;To reproduce this, here is the current full source: &lt;A href="https://gist.github.com/BorisKourt/8ac77261731000be2fb6#file-trackingandremoval-pde-L86" target="_blank"&gt;https://gist.github.com/BorisKourt/8ac77261731000be2fb6#file-trackingandremoval-pde-L86&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Any help/source/workarounds would be supremely appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 20:44:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097538#M67414</guid>
      <dc:creator>Boris_K_</dc:creator>
      <dc:date>2016-03-03T20:44:09Z</dc:date>
    </item>
    <item>
      <title>Updated the gist with the</title>
      <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097539#M67415</link>
      <description>&lt;P&gt;Updated the gist with the crash log: &lt;A href="https://gist.github.com/BorisKourt/8ac77261731000be2fb6" target="_blank"&gt;https://gist.github.com/BorisKourt/8ac77261731000be2fb6&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 21:45:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097539#M67415</guid>
      <dc:creator>Boris_K_</dc:creator>
      <dc:date>2016-03-03T21:45:37Z</dc:date>
    </item>
    <item>
      <title>Fixed by adding:</title>
      <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097540#M67416</link>
      <description>&lt;P&gt;Fixed by adding:&lt;/P&gt;

&lt;PRE class="brush:java;"&gt;        senseMgr.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, 1280, 720, 30);
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In setup. I have updated the linked gist to the latest code.&lt;/P&gt;

&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 22:28:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097540#M67416</guid>
      <dc:creator>Boris_K_</dc:creator>
      <dc:date>2016-03-03T22:28:21Z</dc:date>
    </item>
    <item>
      <title>Hi</title>
      <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097541#M67417</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I just found your thread on toPimage. It looks like you fixed the problem with this function. To me it seems like the function was completely removed from the library now. I opened a thread on that topic &lt;A href="https://software.intel.com/en-us/forums/realsense/topic/671777" target="_blank"&gt;https://software.intel.com/en-us/forums/realsense/topic/671777&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Does your code still work for you? Are you working with an older version of the library? If so could you provide a download for the working library?&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
	jp&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 07:15:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097541#M67417</guid>
      <dc:creator>j__p_</dc:creator>
      <dc:date>2016-07-29T07:15:40Z</dc:date>
    </item>
    <item>
      <title>Hi jp</title>
      <link>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097542#M67418</link>
      <description>Hi jp.

Since nobody comments on any of my questions in this forum I've been at a standstill so far! Ill update to latest and test out my prior code. 

That said: I ended up just copying the function into my regular code and avoid the use of 'toPimage' altogether (And just use the java library jar):

&lt;PRE class="brush:java"&gt;
    public PImage ToPImageCopy(int var1, PImage var2, PXCMImage.ImageData cData) {
        var2.loadPixels();
        cData.ToIntArray(var1, var2.pixels);
        var2.updatePixels();
        return var2;
    }
&lt;/PRE&gt;

Please tell me if more Modules are available to you in Java. As per this thread: &lt;A href="https://software.intel.com/en-us/forums/realsense/topic/611503" target="_blank"&gt;https://software.intel.com/en-us/forums/realsense/topic/611503&lt;/A&gt;
I found that I couldn't access most of the Modules, and unfortunately I don't know if I was doing something wrong or if they are actually un-implemented. 

Good Luck!
Boris

PS: Ping me if you have any other questions, I spent quite a bit of time trying to wrap my head around this earlier this year.</description>
      <pubDate>Fri, 29 Jul 2016 14:04:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Processing-Java-toPimage-fails-with-Segmentation-output/m-p/1097542#M67418</guid>
      <dc:creator>Boris_K_</dc:creator>
      <dc:date>2016-07-29T14:04:51Z</dc:date>
    </item>
  </channel>
</rss>

