Processing only - JMyron blob tracking
Posted: 09 May 2008 06:27 AM   [ Ignore ]
New Member
Avatar
Rank
Total Posts:  3
Joined  2008-05-09

Hello there!

I’m fairly new on the forum so sorry if this question has already been raised.  Was wondering if anyone else has had luck doing blob tracking using the JMyron computer vision library?  I’ve got it working on my system but instead of reinventing the wheel i thought i’d check if anyone’s already gone down this road and found it useful/terrible?

cheers let me know!
-christopher

 Signature 

--------------------------------------
Christopher Chong
MA in Sonic Arts @ SARC Belfast
http://majorc.wordpress.com
http://www.MajorC.co.uk
--------------------------------------

Profile
 
 
Posted: 15 May 2008 01:03 AM   [ Ignore ]   [ # 1 ]
New Member
Avatar
Rank
Total Posts:  8
Joined  2008-05-15

Hi there!

Check this post, I’m looking forward to try JMyron too.

http://nuigroup.com/forums/viewthread/1604/

 Signature 

"If you have an apple and I have an apple and we exchange
these apples then you and I will still each have one apple.
But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas.”
-Shaw

Profile
 
 
Posted: 21 May 2008 05:26 PM   [ Ignore ]   [ # 2 ]
New Member
Avatar
Rank
Total Posts:  3
Joined  2008-05-09

Hey there!

No worries i did it with cv.jit for Max/MSP/JITTER and Processing using OSC.  JMyron will have to wait for the next project!

-christopher

 Signature 

--------------------------------------
Christopher Chong
MA in Sonic Arts @ SARC Belfast
http://majorc.wordpress.com
http://www.MajorC.co.uk
--------------------------------------

Profile
 
 
Posted: 23 May 2008 04:41 AM   [ Ignore ]   [ # 3 ]
New Member
Rank
Total Posts:  6
Joined  2008-03-09

I have just succeeded with touchlib. Soon(maybe the folloing month) I will working on JMyron for my own blob detecting and tracking. Also looking forward to other’s success with it.

Profile
 
 
Posted: 15 July 2008 05:34 AM   [ Ignore ]   [ # 4 ]
New Member
Avatar
Rank
Total Posts:  54
Joined  2008-07-15

i’m currently working on a processing sketch that uses JMyron for blob detection.
the performance is nothing to complain about, however JMYron seems to have a few quirks.

it allows you te fetch an array with the center point of every detected blob at that moment, but the first blob center-point is allways returned as 0x0
Since we will be needing to know where that first blob is in order to make a usefull multi-touch interface, i’m not getting anywhere right now.
does anyone have a solution?

my code is:

//**********BLOB-CENTERS***********//
  //initiate a two dimensional array that will hold the blob centers x and y positions
  int[][] a;

  
//fetch them
  
m.globCenters();
  
  
//draw them
  
stroke(255,128,128);

  
//for every blob center
  //(there appears to be something wrong with jmyron, 
  //it keeps telling me there last blob it finds is 
  //allways at 0x0 which is wrong :( )
  
  
for(int i=0;i<a.length;i++){
    int[] p 
a[i];
    print(
a[i][0] " X " a[i][1] "\n");
    
    
//(this is the exact point of the blob center)
    
point(p[0],p[1]);
    
    
//this is an ellipse around the point to make it easyer to see
    //you might also use it as bounds for tracking objects.
    
ellipse(p[0],p[1],20,20);   
    
  
}

  
//**********************************//

::EDIT::

i just checked out JMyron from CSV and noticed this :

public int[][] globCenters(){
       int b[] 
native_globCenters();
        
int returnArray[][] = new int[b.length/2][2];
        
        
// things went wrong here -----------------------------------
        //the following line used to read
        // for(int i=0;i<b.length/2-1;i++){        

        
for(int i=0;i<b.length/2;i++){
        
//---------------------------------------------------------------
            
returnArray[i][0] b[i*2  ];
            
returnArray[i][1] b[i*2+1];
        
}
        
return returnArray;
    
}

i have attached a fixed, compiled and working jmyron.jar
(tested using all JMyron examples, no errors)
you can just copy it over the original one in your processing/libraries folder

enjoy smile

File Attachments
JMyron.jar  (File Size: 7KB - Downloads: 59)
Profile
 
 
Posted: 15 July 2008 12:31 PM   [ Ignore ]   [ # 5 ]
New Member
Avatar
Rank
Total Posts:  16
Joined  2008-04-30

Good work smile Nice to see somebody else messing with Processing, instead of always Flash, WPF, or Python =)

Profile
 
 
Posted: 15 July 2008 03:57 PM   [ Ignore ]   [ # 6 ]
Sr. Member
Avatar
RankRankRank
Total Posts:  359
Joined  2007-09-18

great to see more people working with P5,
it ‘s easy to connect Touchlib with P5 via OSC .(tuio library)

 Signature 

http://sassexperience.org

Profile
 
 
Posted: 16 July 2008 01:49 AM   [ Ignore ]   [ # 7 ]
New Member
Avatar
Rank
Total Posts:  54
Joined  2008-07-15
TherioN - 15 July 2008 12:31 PM

Good work smile Nice to see somebody else messing with Processing, instead of always Flash, WPF, or Python =)

thanks smile
There’s a lot of stuff going on in multi-touch land at the moment, and i wanted to find a way to contribute.
Processing had been on my mind for a while allready, because of JMyron, Arduino and Wiring, and the active user group.
and i just love how easy and lightweight processing is at the same time.
i do flash too, but i’ve been around ActionScript 1 and 2.0, and i just find 3.0 horribly confusing. rasberry
i looked at VVVV but it gave me headaches

because I have mostly been working with java, and am currently learning C#, i like languages like processing from the get-go.
(yay, laziness! rasberry)

So i fixed JMyron, submitted the patch to SourceForge and i’m writing my own little blob handling sketch.
here’s a screenie (sorry, i don’t have an FTIR yet, i’m trying to get it to work with a MTMini :( )
blobsblobsblobs.PNG

::edit::

don’t use my JMyron replacement yet, it’s still quirky :(
it works fine when displaying an uneven number of blobs now, however it makes up artifact blobs when it finds an even number.

whoops.PNG

stay posted, i will have a new replacement soon.

::edit::

--UPDATE--

WIN.PNG

JMyron blob-center tracking now works as it should, tested 100% :D
The problem was, that myron returned the coordinates in a normal array of integers, and added an empty zero at the end of that array for every blob.
It took me a while to figure it out though.

this fixed it :

public int[][] globCenters(){
       int b[] 
native_globCenters();
       
       
//returnArray[] should be b.length/3 instead of b.length/2
        
int returnArray[][] = new int[b.length/3][2];
        
        
        
//Myron natively returns three (3)
        //coordinates per-glob...
        //since the last coordinate is added
        //as a single zero at the end of native_globcenters[]
        //we itterate through one third of the number
        //of coordinates
        //(we fetch two coordinates each time, so we actually
        // get two third of the coordinates this way)
        
        //id will point at the 'glob' whose coordinates we are getting
        
int id 0;
        
        
//itterate through one third of the available coordinates
        
for(int i=0;i<b.length/3;i++){
            
            returnArray[i][0] 
b[id*2  ];
            
returnArray[i][1] b[id*2+1];
            
            
//increment id
            
id++;
        
}
        
return returnArray;
    
}

the fixed JMyron.jar is attached to this post.
enjoy it, and start making stuff! :D

File Attachments
JMyron.jar  (File Size: 7KB - Downloads: 77)
Profile
 
 
Posted: 16 July 2008 08:50 AM   [ Ignore ]   [ # 8 ]
Jr. Member
Avatar
RankRank
Total Posts:  188
Joined  2007-09-13

I’ve playing with Processing myself for the last couple of months, but have not tried JMyron yet. The main reason I’ve been sticking with Touchlib is camera input. I’ve heard Processing uses Quicktime to grab the camera feed, and that it doesn’t work too well in Windows.

Does JMyron works differently or you guys are running a different OS?

Profile
 
 
Posted: 16 July 2008 08:55 AM   [ Ignore ]   [ # 9 ]
New Member
Avatar
Rank
Total Posts:  54
Joined  2008-07-15

JMyron is no longer dependant of Quicktime, and is a very fast solution to do blobtracking.
In fact, simply fetching pictures from your webcam goes faster with JMyron than through quicktime wink
Go ahead, try it.

be sure to replace the JMyron.jar file from the official JMyron with my version, or you’ll end up very confused when you start using globCenters();

also, i’m using windows smile

Profile
 
 
Posted: 16 July 2008 08:56 AM   [ Ignore ]   [ # 10 ]
Jr. Member
Avatar
RankRank
Total Posts:  188
Joined  2007-09-13

Cool, I’ll give it a go, thanks!

Profile