Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Boris_K_
Beginner
73 Views

[Processing][Java] toPimage fails with Segmentation output.

Hello,

I just picked up a laptop with an F200 in it, and am working on a quick tech demo for the camera.

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.

The problem comes up in the following part of the code: (Full source linked in gist at end.)

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"); 
}

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:

#
# 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:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

I can provide the error report file if necessary

Again, nothing ever crashes until I start to call 'toPimage'

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?

To reproduce this, here is the current full source: https://gist.github.com/BorisKourt/8ac77261731000be2fb6#file-trackingandremoval-pde-L86

Any help/source/workarounds would be supremely appreciated!

0 Kudos
4 Replies
Boris_K_
Beginner
73 Views

Updated the gist with the crash log: https://gist.github.com/BorisKourt/8ac77261731000be2fb6

Boris_K_
Beginner
73 Views

Fixed by adding:

        senseMgr.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, 1280, 720, 30);

 

In setup. I have updated the linked gist to the latest code.

Best

j__p_
Beginner
73 Views

Hi

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 https://software.intel.com/en-us/forums/realsense/topic/671777

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?

Regards
jp
 

Boris_K_
Beginner
73 Views

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):
    public PImage ToPImageCopy(int var1, PImage var2, PXCMImage.ImageData cData) {
        var2.loadPixels();
        cData.ToIntArray(var1, var2.pixels);
        var2.updatePixels();
        return var2;
    }
Please tell me if more Modules are available to you in Java. As per this thread: https://software.intel.com/en-us/forums/realsense/topic/611503 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.
Reply