t-oster / VisiCam

A Java application, that turns a webcam into a VisiCut compatible network camera with marker detection and perspective correction. Uses OpenCV through JavaCV
Other
36 stars 12 forks source link

Installing VisiCam on Raspberry Pi running Arch Linux #4

Open peteruithoven opened 10 years ago

peteruithoven commented 10 years ago

I've bin trying to install VisiCam on a Raspberry Pi, this time on Arch Linux: https://github.com/t-oster/VisiCam/wiki/Raspberry-Pi-installation-(Arch-Linux)

It seems to be installed correctly, I'm able to take snapshots, configure the marker locations. But it can't generate the corrected image. Going to the main page I get the error:

Taking Snapshot...
Finding markers...
Exception in thread "Thread-26" java.lang.UnsatisfiedLinkError: com.googlecode.javacpp.Pointer$NativeDeallocator.deallocate(JJ)V
    at com.googlecode.javacpp.Pointer$NativeDeallocator.deallocate(Native Method)
    at com.googlecode.javacpp.Pointer$NativeDeallocator.deallocate(Pointer.java:145)
    at com.googlecode.javacpp.Pointer$DeallocatorReference.clear(Pointer.java:193)
    at com.googlecode.javacpp.Pointer.deallocateReferences(Pointer.java:202)
    at com.googlecode.javacpp.Pointer.deallocator(Pointer.java:253)
    at com.googlecode.javacpp.Pointer.init(Pointer.java:78)
    at com.googlecode.javacv.cpp.opencv_core$CvSize.allocate(Native Method)
    at com.googlecode.javacv.cpp.opencv_core$CvSize.<init>(opencv_core.java:2525)
    at com.googlecode.javacv.cpp.opencv_core.cvSize(opencv_core.java:2559)
    at com.googlecode.javacv.cpp.opencv_core$IplImage.create(opencv_core.java:419)
    at com.googlecode.javacv.cpp.opencv_core$IplImage.createFrom(opencv_core.java:509)
    at com.googlecode.javacv.cpp.opencv_core$IplImage.createFrom(opencv_core.java:481)
    at com.googlecode.javacv.cpp.opencv_core$IplImage.createFrom(opencv_core.java:478)
    at com.t_oster.visicam.CameraController.findMarker(CameraController.java:105)
    at com.t_oster.visicam.VisiCamServer.serveTransformedImage(VisiCamServer.java:175)
    at com.t_oster.visicam.VisiCamServer.serve(VisiCamServer.java:141)
    at gr.ktogias.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:443)
    at java.lang.Thread.run(Thread.java:722)
peteruithoven commented 10 years ago

I guess it did find a marker, because when I remove all markers I get:

Taking Snapshot...
Finding markers...
Found 0/4 markers
Applying transformation...
t-oster commented 10 years ago

Just a wild guess: Do the versions of the installed java-cv and open-cv match? As I understand it, java-cv is a wrapper for the native open-cv libraries, so if there are broken links, maybe due to different versions?

peteruithoven commented 10 years ago

Could be... There is a minimal requirement, 2.4.3, as I read on the readme here: https://github.com/t-oster/VisiCam/tree/master/lib/javacv-bin I seem to have 2.4.7. checked using pkg-config --modversion opencv I compiled javacv following: http://salaboy.com/2013/06/14/using-javacv-in-the-raspberry-pi-linux-arm/ I then copied the generated javacpp jar to visicam using: cp /root/javacv/target/javacpp.jar /root/VisiCam/dist/lib

But, weird thing is that you clone both javacv and javacpp but you only go into javacv for compilation, but then it does generate the javacpp.jar I copied.

Also weird, it ends with KILLED...

[root@visicam ~]# cd javacv
[root@visicam javacv]# mvn clean install -Dplatform.name=linux-arm
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCV 0.6
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ javacv ---
[INFO] Deleting /root/javacv/target
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:properties (properties) @ javacv ---
[INFO] 
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) @ javacv ---
[INFO] Copying javacpp-0.6.jar to /root/javacv/target/javacpp.jar
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ javacv ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3:compile (default-compile) @ javacv ---
[INFO] Compiling 43 source files to /root/javacv/target/classes
Killed

Installing using the -X option, for debugging doesn't display any errors. So I'm kind of assuming Killed is positive.

(In the meantime I'm also trying to rebuild the app in c++, using openFrameworks.)

peteruithoven commented 10 years ago

So it worked on Raspbian, but if someone wants to try it on Arch Linux, maybe check if you can alter the cpu/gpu memory split. This is something I had to do on Raspbian to compile openFrameworks. Try decreasing the split for gpu to something like 64 for example. It's probably best to restore it after compilation.