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 & HelpPrograms › colorfill a blob detected with the v3ga lib
Page Index Toggle Pages: 1
colorfill a blob detected with the v3ga lib? (Read 683 times)
colorfill a blob detected with the v3ga lib?
May 12th, 2006, 1:48am
 
Hi,

I have a little Problem with a task I think should be awfully simple. I use the v3ga Blobdetection Libary (http://v3ga.net/processing/BlobDetection/Library/)to detect blobs on a webcam image. It all works pretty well and drawing the edges is pretty easy. But I now want to fill the space inside these edges. I tried to let the lib compute triangles for the inner space:

for (int n=0 ; n<theBlobDetection.getBlobNb() ; n++)
 {
   b=theBlobDetection.getBlob(n);
   if (b!=null)
   {

      for (int t=0 ; t<b.getTriangleNb() ; t++)
      {
        tr = b.getTriangle(t);
        if(tr != null)
        {
          eA = b.getTriangleVertexA(tr);
          eB = b.getTriangleVertexB(tr);
          eC = b.getTriangleVertexC(tr);
          if (eA !=null && eB !=null && eC != null)
          {
             beginShape();
             vertex(eA.x*width, eA.y*height);
             vertex(eB.x*width, eB.y*height);
             vertex(eC.x*width, eC.y*height);
             endShape();
          }
        }
      }
   }
 }


but I could hardly make it fill all the blobs. At somepoint it just stops filling out the edges. I also tried to increase the amount of Triangles per Blob via setConstants() but it never worked well. Could this be a graphics card issue?

It just seems way to complicated to me to calculate a few thousand triangles to simply fill this blobs...

Is there a clever way to do this?

Thanks for your time,
best

uli

Re: colorfill a blob detected with the v3ga lib?
Reply #1 - May 13th, 2006, 7:48pm
 
i'm working on the exact same problem... and i haven't been able to solve it, yet.  

my approach was to try to increase the number of triangles that can be drawn per blob.  

i am thinking that it is being limited by the default value.  in the documentation for the v3ga blobdetection is setConstants which allows you to set the number of edges, blobs and triangles allowed. the default value is 500 for the number of triangles.  but, when i set this value higher than 500 then i get a runtime error:

ArrayIndexOutofBoundsException on the computeBlobs call.

so far, i'm still stuck. but, i think this problem is the key to filling the silhouettes with triangles.

if anyone out there knows the secret please let me know.

thanks,
chris
Re: colorfill a blob detected with the v3ga lib?
Reply #2 - May 14th, 2006, 12:36am
 
Hi,
setConstants() is a static method of the BlobDetection. It sets up some constants used by instances to allocate some chunks of memory for recording pieces of informations about blobs. It has imperatively to be called before any instance is created. May be a better thing to do would be not to make setConstants static, thus allowing fine-tuning memory allocation for each instance.
Re: colorfill a blob detected with the v3ga lib?
Reply #3 - May 16th, 2006, 4:37pm
 
wouldn't it be very easy to have an option that every pixel inside a blob is filled with a certain color? I don't have a complete Idea about how this imaga analysis exactly works, but as it's something with analzing pixels this filling can't be to hard?

By the way, thanks very much for your effort in making this great working lib v3ga!

Page Index Toggle Pages: 1