We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Issue with blobs not closing with JMyron.
Page Index Toggle Pages: 1
Issue with blobs not closing with JMyron. (Read 830 times)
Issue with blobs not closing with JMyron.
Nov 23rd, 2009, 2:28am
 
Hi everyone!

I'm working on some blob detection using JMyron. My goal is to consistently detect blobs and then outline & fill them.

I've encountered a strange problem - some blob shapes don't seem to be closing. This results in long lines cutting across the blobs, and the fill not looking right.

Any help would be hugely appreciated. I really love processing but can't seem to get past this issue!

Here's a link to a screenshot:
benzer.la/images/storage/blob_problem.gif

Here's the code:

Code:

import JMyron.*;

PImage buffer;
float level;

JMyron m1, m2;

void setup(){
 int w = 640;
 int h = 480;
 size(w,h);
 m1 = new JMyron();
 m2 = new JMyron();
 m1.start(640,480);
 m1.findGlobs(1);
 buffer = new PImage (640, 480);
}

void draw(){
 m1.trackColor(255,255,255,220);
 m1.update();
 m1.imageCopy(buffer.pixels);
 buffer.updatePixels();
 buffer.filter(THRESHOLD, 0.5);
 
 background(100);
 fill(255,255,255);
 noStroke();
 ellipse(250,250,150,150);
 rect(250,250,150,150);
 image(buffer, 0, 0);
 
 buffer = get();
 m2.findGlobs(1);
 m2.hijack(640, 480, buffer.pixels);
 m2.trackColor(255,255,255,5);
 m2.minDensity(300);
 m2.update();
 
 int list[][][] = m2.globEdgePoints(4);
 stroke(250,0,250);
 for(int i=0;i<list.length;i++){
   fill(250,250,0);
   int[][] pixellist = list[i];
   if(pixellist!=null){
     beginShape();
     for(int j=0;j<pixellist.length;j++){
       vertex(pixellist[j][0], pixellist[j][1]);
     }
     endShape(CLOSE);
   }
 }
}

public void stop(){
 m1.stop();
 m2.stop();
 super.stop();
}

Re: Issue with blobs not closing with JMyron.
Reply #1 - Nov 28th, 2009, 3:48pm
 
Bump!

Can anyone offer any advice? If anyone's interested, I'd be more than willing to pay for a solution!
Page Index Toggle Pages: 1