Re: soclesdemo trouble

106 views
Skip to first unread message

Michael Zucchi

unread,
Feb 28, 2012, 4:00:37 AM2/28/12
to Abelino Romo, socles-...@googlegroups.com
Hi Abelino,

I think that is a version mismatch between the installed jogamp and
soclesdemo. It lools like i'm using
jocl-0.9-b13-21000303-linux-amd64(!). Which is very ancient. To
confirm I tried running against the latest and I get the same error: so
yeah must be.

So i had a look at updating to the latest version, but there are some
issues:
- i've a ton of experimental/unfinished code I need to
fix/cleanup/remove. unfortunately it's been so long i'm not sure what's
junk and what's important.
- it seems to run a lot slower on the face stuff - from about
30ms/frame to 40ms/frame on my amd card :( (nvidia was ~10ms). But now
i've changed it it's too hard to go back and verify ...
- they've changed the way local libraries can be loaded, which just
needs more stuff included in the build

Otherwise, there were no problems updating the api with any of the
public code.

So what i'll do is patch the current head to the latest jocl 2.0
release. I can probably do this tonight. Check for updates in the
commit logs/news.

Regards,
Michael

On 28/02/12 18:16, Abelino Romo wrote:
> Hello there my name is Abelino. I am having a little problem trying to run the soclesdemo webcamfx.java
> This is my first time messing with jogamp, and this is the exception I am getting at run. I hope you have the time to reply to me. Thank you sooo much. If I am able to get this running, I am planning on incorporating the face detection algo as an input to a game. Thanks a lot.
>
> socles.jar:
> compile:
> run:
> Exception in thread "main" java.lang.UnsatisfiedLinkError: com.jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
> at com.jogamp.common.jvm.JVMUtil.initialize(Native Method)
> at com.jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:59)
> at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:1141)
> at soclesdemo.webcam.WebcamFX.main(WebcamFX.java:544)
> Java Result: 1
> BUILD SUCCESSFUL (total time: 0 seconds)
>

Michael Zucchi

unread,
Feb 29, 2012, 1:16:09 AM2/29/12
to Abelino Romo, socles-...@googlegroups.com

Hi Again,

Looks like i've been using non-standard vector literals, and maybe it
doesn't like that - the {} syntax.

I've just committed a change to the literals in that file, but there are
probably others around the code as I picked up that habit from another
compiler (i just did a search on '(int2) {' and there's 48 just of
those). Let me know if that fixes the problem then I can change the
other references likewise.

Cheers,
Michael


On 29/02/12 16:08, Abelino Romo wrote:
> Thanks for getting back to me I really appreciate it. You are amazing. I just downloaded the latest trunck and included the mac-universal jars to the project. But since I am using Nvidia I think I have to modify it a bit. I am getting this error at runtime: (if you could shed some light or steer me on the right direction I would greatly appreciate it)
>
> Thanks in advance,
> Abelino
>
> socles.jar:
> compile:
> run:
> Using device: GeForce 8600M GT
> init!
> Loading image_formats.cl with
> Exception in thread "main" com.jogamp.opencl.CLException$CLBuildProgramFailureException:
> CLDevice [id: 16918016 name: GeForce 8600M GT type: GPU profile: FULL_PROFILE] build log:
> <program source>:97:39: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:97:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:123:39: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:123:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:145:39: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:145:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx, gy }, p);
> ^
> <program source>:170:38: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ x, gy }, p);
> ^
> <program source>:170:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ x, gy }, p);
> ^
> <program source>:177:40: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ x+1, gy }, p);
> ^
> <program source>:177:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ x+1, gy }, p);
> ^
> <program source>:200:43: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx*4+0, gy }, p0);
> ^
> <program source>:200:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx*4+0, gy }, p0);
> ^
> <program source>:201:43: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx*4+1, gy }, p1);
> ^
> <program source>:201:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx*4+1, gy }, p1);
> ^
> <program source>:202:43: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx*4+2, gy }, p2);
> ^
> <program source>:202:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx*4+2, gy }, p2);
> ^
> <program source>:203:43: error: too many arguments provided to function-like macro invocation
> write_imagef(dst, (int2){ gx*4+3, gy }, p3);
> ^
> <program source>:203:3: error: use of undeclared identifier 'write_imagef'
> write_imagef(dst, (int2){ gx*4+3, gy }, p3);
> ^
> <program source>:195:10: warning: unused variable 'p0'
> float4 p0 = { s0.s0, s0.s1, s0.s2, 1 };
> ^
> <program source>:196:10: warning: unused variable 'p1'
> float4 p1 = { s0.s3, s1.s0, s1.s1, 1 };
> ^
> <program source>:197:10: warning: unused variable 'p2'
> float4 p2 = { s1.s2, s1.s3, s2.s0, 1 };
> ^
> <program source>:198:10: warning: unused variable 'p3'
> float4 p3 = { s2.s1, s2.s2, s2.s3, 1 };
> ^ [error: CL_BUILD_PROGRAM_FAILURE]
> at com.jogamp.opencl.CLException.newException(CLException.java:78)
> at com.jogamp.opencl.CLProgram.build(CLProgram.java:390)
> at com.jogamp.opencl.CLProgram.build(CLProgram.java:271)
> at au.notzed.socle.SOCLECommand.build(SOCLECommand.java:54)
> at au.notzed.socle.image.ImageFormats.<init>(ImageFormats.java:50)
> at au.notzed.socle.image.ImageFormats.get(ImageFormats.java:71)
> at soclesdemo.webcam.WebcamFX.initcl(WebcamFX.java:186)
> at soclesdemo.webcam.WebcamFX.<init>(WebcamFX.java:143)
> at soclesdemo.webcam.WebcamFX.main(WebcamFX.java:545)
> Java Result: 1
> BUILD SUCCESSFUL (total time: 3 seconds)

Michael Zucchi

unread,
Feb 29, 2012, 3:42:05 AM2/29/12
to Abelino Romo, socles-...@googlegroups.com
Hi Abelino,

Oh well, yes of course, video 4 linux only works on linux. That you
were using macos gave me a niggle about it working when you mentioned
it, but I wasn't sure why ... obvious now :)

Your best bet is trying to find a java interface for the mac camera
interface if one such exists. If not, you'll have to try and integrate
with the objective-c code using JNI I guess. JNI to C or C++ is fairly
trivial, not sure about with objective-c's runtime though, plenty about
it on the net though i'm sure.

A quick search found this suggestion amongst others less helpful:
http://stackoverflow.com/questions/3750568/get-webcam-stream-on-mac-os-x-in-java

Maybe the link about Accessing Cocoa from Java will help avoid any
direct jni, but i'm only speculating: I haven't used a mac for over 15
years, and that was only because I was a sysadmin at the time!

Cheers,
Michael

On 29/02/12 18:22, Abelino Romo wrote:
> Hey Michael,
> Thanks for all your help. I managed to fix all the syntax issues with (int2) { on the required files. But now I'm getting an issue with v4l4j since its for Linux machines and I am running OS X Lion (which is still unix based) so its giving me the following:
>
> I do have an Objective-C project that I worked on with OpenCV late last year. I managed to utilize the webcam using QTKit and OpenGL to reduce CPU overhead. So its very economical. So now I have to somehow link the soclesdemo with the Objective-C project. Or do you have any ideas? You have been such great help so far. I really do appreciate it?
>
> Cant load v4l4j JNI library
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no v4l4j in java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
> at java.lang.Runtime.loadLibrary0(Runtime.java:823)
> at java.lang.System.loadLibrary(System.java:1045)
> at au.edu.jcu.v4l4j.VideoDevice.<clinit>(Unknown Source)
> at soclesdemo.webcam.WebcamFX.opencamera(WebcamFX.java:206)
> at soclesdemo.webcam.WebcamFX.start(WebcamFX.java:147)
> at soclesdemo.webcam.WebcamFX.main(WebcamFX.java:545)
>
> Thanks,
> Abelino

Michael Zucchi

unread,
Mar 9, 2012, 2:38:19 AM3/9/12
to Abelino Romo, socles-...@googlegroups.com
Hi Abelino,

Another case where linux is easier, webcames on windows are a pita to
code too.

I find JNI simple and pretty well implemented, but anyway, each to their
own - thats all the v4l4j is using too. I can't help you with any
objective c, so you're on your own there, as with macos.

The dependencies of the detector should be fairly easy to work out,
perhaps just copy it to another project and keep adding stuff till it
stops complaining about missing stuff. Note that none of the sobel,
median or klt stuff has anything to do with the vj detector; they're
just part of the webcam demo (although certain pre-processing may help;
but you'll have to experiment). It does need the integral image stuff
too at least, but i'm sure you can read the code to work out what is
needed just as easily as i can.

Michael

On 09/03/12 15:37, Abelino Romo wrote:
> I haven't had time to work on this little project. Today I tried a couple java webcam interfaces for Mac but none were able to discover the webcam. I then tried Java Media Framework and the same thing; it just couldn't discover the webcam as a device. So since the only one that works is an SDK (which requires expensive licensing). I forgot the name since dismissed it since I want to keep this open source, but I did read through its documentation and for Linux it uses video 4 linux, for mac it uses QTKit (I can't find much help on Java bindings that will allow me to use native QTKit), and for windows they had 2 open source projects (don't remember the names).
>
> So my only option is to port the socles VJDetection to Objective-C. I looked through OpenCV and its CUDA implementation buts its just too much to understand/handle. Porting the JAVA to Objective-C shouldn't be that much of a problem. I have more experience in JAVA than Objective-C but since I am running Macs its the ideal solution. JNI would be another avenue to explore but from my experience with it, its much more of a pain than anything.
>
> All I really need for my little game would be the Viola Jones Detection, and if you have a couple of minutes would you mind giving me a rundown of everything that I would need to port to have everything running. So far I am working on Median.java, Sobel.java, ImageFormats.java, KLT.java, KLTTracking.java
> not sure which are needed from the au.notzed.socle.filter package.
>
>
> Thanks a million for all the advice
> -Abelino

Reply all
Reply to author
Forward
0 new messages