Go to Post One of those things I learned in kindergarten - never introduce myself to an “enraged” woman wielding a clipboard. - Mark McLeod [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 05-02-2012, 09:33
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Standalone image analysis.

We are trying to use the WPIBinaryImage class as well for finding contour lines. It seems to work well. However, we are struggling to use it continuously.

To us it appears that there is a huge native memory leak (something inside the native code) when the findContours() method actually finds contour lines.

Could you tell me whether or not your code includes a line like the following (where findBin is instance of a WPIBinaryImage)?

Code:
WPIContour[] contours = finalBin.findContours();
If so, do you see your process start to consume vast amounts of memory when continuously processing images from the camera (looking at its status using the Windows Task Manager)?

We've found that we can process a few images without issues, but if we try to run continuously (processing hundreds of frames), our process hits 1 GB of RAM usage and quickly continues to grow until memory is exhausted.

We don't seem to hit the memory issue if we don't use the findContours() method, or if the findContours() method doesn't locate anything (memory usage only appears to explode when contours are found).

In any case, I'd be curious to know if you've run across this issue as well and if so how you worked around it.

Here's our "do nothing" minimal vision processing code which demonstrates the memory leak using only the WPI classes and methods:

Code:
package com.techhounds.camera;
import edu.wpi.first.smartdashboard.camera.WPICameraExtension;
import edu.wpi.first.wpijavacv.WPIBinaryImage;
import edu.wpi.first.wpijavacv.WPIColorImage;
import edu.wpi.first.wpijavacv.WPIContour;
import edu.wpi.first.wpijavacv.WPIGrayscaleImage;
import edu.wpi.first.wpijavacv.WPIImage;

/**
 * A "trivial" SmartDashboard camera extension demonstrating the memory
 * leak issue in the
 *
 * @author pkb
 */
public class MemoryLeakExtension extends WPICameraExtension {

    @Override
    public WPIImage processImage(WPIColorImage colorImg) {

        // Pull out one color
        WPIGrayscaleImage grayImg = colorImg.getBlueChannel();

        // Reduce to black and white for contour tracing
        WPIBinaryImage binImg = grayImg.getThreshold(200);

        // Find the contours within the image (unfortunately memory
        // is leaked big time as soon as it starts finding contours)
        WPIContour[] contours = binImg.findContours();

        // Let the dash board display the gray image
        return grayImg;
    }

}
Thanks,
Paul
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:09.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi