2 of 2
2
Anyone using (or used) Java for multitouch?
Posted: 24 July 2008 09:03 AM   [ Ignore ]   [ # 16 ]
New Member
Rank
Total Posts:  86
Joined  2007-10-22
fjen - 24 July 2008 02:20 AM

hi ElkMonster, i’m working on a JNI camara capture (firefly) via libdc implementation (os-x + processing.org user) myself. well, “working” might not be the right term, “planning on” is. since i’m not into reinventing the wheel too much, would you consider sharing that part of your code?

Definitely, I just haven’t found the time to clean up the code yet. In a way, I’m kind of a perfectionist and I don’t like to publish things that are not in a satisfying state… so, just give me a few more days. smile (Is that ok for you?)

By the way, the code was written for version 1 of libdc1394 (as I was using Ubuntu, which currently is still stuck there; however, they’ll upgrade in the next Ubuntu). Version 2 is a little different (but cleaned up). I don’t know which version all the different Linux distros are using, but version 2 is probably the way to go. I’d be happy to take part in the development of a more mature implementation, as mine was pretty crappy (because it was hacked together in only a few days).

Maybe we should create a new thread for this to coordinate our efforts. I’ll then post what I have as soon as it’s in an acceptible state. wink

Profile
 
 
Posted: 24 July 2008 10:31 AM   [ Ignore ]   [ # 17 ]
New Member
Rank
Total Posts:  2
Joined  2008-07-24

i’m on a pretty tight timeframe for this project so i guess i’ll go ahead an see where it leads me.
.. or, if you want to, mail me (mail -a--t-- bezier -dot-- de) the code in it’s current state and i’ll see if i can pitch in cleaning it up.

new thread sounds good to me!

thanks
F

Profile
 
 
Posted: 24 July 2008 12:20 PM   [ Ignore ]   [ # 18 ]
New Member
Rank
Total Posts:  86
Joined  2007-10-22
fjen - 24 July 2008 10:31 AM

i’m on a pretty tight timeframe for this project

Well, in this case I’ll ignore perfectionism and put it together now. I’ll try to get it done until tomorrow, maybe even tonight.

Profile
 
 
Posted: 14 August 2008 11:26 AM   [ Ignore ]   [ # 19 ]
New Member
Rank
Total Posts:  7
Joined  2008-05-21

@ElkMonster: The decision tree idea for gesture recognition sounds really interesting! I might be interested in adapting that part of your framework to create multitouch events from TUIO messages.  (E.g.: Use BBTouch or similar to detect blobs and generate TUIO messages, use reactivision’s TUIO_java client to receive the messages and then use your framework to bundle them into MT events). My university is using JOGL for a ‘Fundamentals of Computer Graphics’ course this semester, and I’d like to throw something together that would allow the students to write JOGL programs that they could interact with on my MT table.  If you’re interested just let me know!

Profile
 
 
Posted: 15 August 2008 08:43 AM   [ Ignore ]   [ # 20 ]
New Member
Rank
Total Posts:  86
Joined  2007-10-22

Hi cpollet, sadly our framework is not publicly available (see somewhere above in this thread for more information), so it’s currently not possible for people outside my university to use it. However, as our framework includes all the steps from image capturing to MT events, taking out only the gesture recognition part would not be an easy task. To be honest, I have quite some doubts that it would even be possible at all without heavily modifying and/or rewriting the whole thing. (For example, our framework creates and keeps up path data structures for each blob, generates single-touch events for each finger, which are then processed by the gesture recogniser - so the whole thing is based on some custom data types which cannot be easily replaced.)

Having said that, it seems to make much more sense to build a new implementation up from scratch. Of course, I could provide some help like drawings and schemata I made for documentation purposes, maybe some code to give you an idea of how I’ve implemented it, and, after all, experience… wink
One further problem is that the gesture recognition part is definitely the most untidy, confusing part of the whole framework, urgently in need of a cleanup and better documentation… I got lost there a few times myself. :D

Anyway, I hope you’re not too disappointed… If you’re still interested, get in touch with me. smile

Profile
 
 
Posted: 18 August 2008 09:51 AM   [ Ignore ]   [ # 21 ]
New Member
Rank
Total Posts:  6
Joined  2008-08-18

Hello, first of all, i’m indonesian, sorry for my bad english..  confused

I’have developed blob tracking with JMF and JAI, and now i’m trying to make the end application with javafx..

please see http://multitouch.linuxity.org (sorry, in indonesia)

is there any somebody who has experienced in optimizing java program?
now i has reached >100fps when there are no blob detected.. and about 40fps when whe create about 10 blob..

my laptop specs :
-toshiba m55
-intel centrino sonoma 1.86Ghz
-1GB RAM
-intel 915GM
-openSUSE 11.0, switched to mint 5.0
-jdk 6u10 (with -server -Xms128M -Xmx256M JVM tuning)

somebody can help me??

Best regards..

Profile
 
 
Posted: 18 August 2008 10:49 AM   [ Ignore ]   [ # 22 ]
New Member
Rank
Total Posts:  86
Joined  2007-10-22

Hi and welcome to the forums. smile

whiledan - 18 August 2008 09:51 AM

is there any somebody who has experienced in optimizing java program?
now i has reached >100fps when there are no blob detected.. and about 20-30 fps when whe create about 10 blob..

It seems to me that you’re using a bad algorithm for your edge detection. Considering the specs of your laptop, 100 fps for no blobs is fine. Looking at the screen shots on your blog, I can see your edge puts out a very detailed outline of the edges. Are you using JAI for the job? If so, JAI’s edge detection seems to be rather complex, involving kernel matrix operations and things like that. Try to find a better edge detector… maybe this one?

Concerning Java optimisation in general, simply work with the lowest level data you have (that is byte arrays, probably), do not use any kind of (Buffered)Image, re-use objects instead of creating new ones (creating a new byte array for 640x480 pixels for every frame is evil! wink ). Only write to the arrays when absolutely needed.
All in all, these are just tweaks to avoid some slowdowns; there’s no magic that will turn your code into something incredibly fast…

Profile
 
 
Posted: 18 August 2008 03:10 PM   [ Ignore ]   [ # 23 ]
New Member
Rank
Total Posts:  6
Joined  2008-08-18
ElkMonster - 18 August 2008 10:49 AM

It seems to me that you’re using a bad algorithm for your edge detection. Considering the specs of your laptop, 100 fps for no blobs is fine. Looking at the screen shots on your blog, I can see your edge puts out a very detailed outline of the edges. Are you using JAI for the job? If so, JAI’s edge detection seems to be rather complex, involving kernel matrix operations and things like that. Try to find a better edge detector… maybe this one?

Concerning Java optimisation in general, simply work with the lowest level data you have (that is byte arrays, probably), do not use any kind of (Buffered)Image, re-use objects instead of creating new ones (creating a new byte array for 640x480 pixels for every frame is evil! wink ). Only write to the arrays when absolutely needed.
All in all, these are just tweaks to avoid some slowdowns; there’s no magic that will turn your code into something incredibly fast…

Hello Elk, thanks for your reply.. yeah, after lot of optimisation, finally i’ve got more performance smile thanks alot!!
No blob : reached 220fps
10 blob : about 50-70fps
Please remind that i’ve turned off all the image visualization.. so there are just the raw image visualization, and the UDP packet generation, for the end application..
For the edge detection, you’re right, i use java native method to produce edge detected image.. smile
Regards…

Profile
 
 
Posted: 18 August 2008 04:12 PM   [ Ignore ]   [ # 24 ]
New Member
Rank
Total Posts:  86
Joined  2007-10-22

One more thing I forgot: Use System.arraycopy() instead of a loop. This is especially true when using Java 6, they’ve speeded it up there.

Profile
 
 
Posted: 19 August 2008 10:36 AM   [ Ignore ]   [ # 25 ]
New Member
Rank
Total Posts:  6
Joined  2008-08-18

Thanks ElkMonster!
now it reached 333fps.. smile

Oh, forgive me, i haven’t told that i use just 160x120px input..  smile Sorry..  :(

160x120px input :
no blob : 333 fps
10 blob : +- 150fps

Please don’t forget my laptop’s spec.. smile

Profile
 
 
   
2 of 2
2