jloyd / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Can't Use IplImage on Android #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add JARs and .so's as per README instructions
2. execute IplImage image = IplImage.create(100, 100, IPL_DEPTH_8U, 4);

What is the expected output? What do you see instead?
I expect to get an IplImage object, instead I get an exception.

What version of the product are you using? On what operating system?
June 10, 2011 JavaCV release
OpenCV-2.2.0-android-arm (armeabi i.e. *not* -v7a)
Android API level 10

Please provide any additional information below.
It seems IplImage relies on java/awt/image/BufferedImage which isn't available 
on Android.

logcat output:
D/dalvikvm(  646): VFY: dead code 0x0200-020a in 
Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage 
(DLjava/awt/color/ColorSpace;)Ljava/awt/image/BufferedImage;
W/dalvikvm(  646): Exception Ljava/lang/UnsatisfiedLinkError; thrown while 
initializing Lcom/googlecode/javacv/cpp/opencv_core;
W/dalvikvm(  646): Exception Ljava/lang/ExceptionInInitializerError; thrown 
while initializing Lcom/googlecode/javacv/cpp/opencv_core$CvArr;
D/AndroidRuntime(  646): Shutting down VM
W/dalvikvm(  646): threadid=1: thread exiting with uncaught exception 
(group=0x40015560)
E/AndroidRuntime(  646): FATAL EXCEPTION: main
E/AndroidRuntime(  646): java.lang.ExceptionInInitializerError
...enters my code

Any help on getting this running in my environment?

Original issue reported on code.google.com by icymidni...@gmail.com on 16 Jun 2011 at 11:08

GoogleCodeExporter commented 9 years ago
I think you forgot to add the .so files from javacv-android-arm.jar. Please 
read the README.txt file... again

Original comment by samuel.a...@gmail.com on 17 Jun 2011 at 12:08

GoogleCodeExporter commented 9 years ago
Hi Samuel,
I too, along with many others apparently, have been getting this same message.  
I've been following your instructions to the letter for android, Facepreview 
starts to run but then quits.  Logcat shows the same types of errors, regarding 
java.awt .  Additional messages include : "VFY: unable to find class referenced 
in signature (Ljava/awt/"     

I know you mention often that awt is not in android, but I'm just running the 
facepreview code that you made, not adding anything else.  Your apk works just 
fine though on the samsung galaxy tab I'm using.  

BuferredImage keeps being called, which isn't available, but your source code 
makes use of IPLimage which appears to be making use of BufferedImage, at least 
that's what Logcat says.  

When I download the facepreview project, there is a jni.jar file there.  I also 
added this to the classpath too, along with javacpp.jar, and javacv.jar; i made 
sure they were in the lib folder and then right clicked on project properties 
and added those 3 to the build path.  I also unzipped with 7zip the .so files 
from javacv-android-arm.jar and the opencv precompiled for android 
OpenCV-2.2.0-android-arm.zip.  They're all in the armeabi folder which itself 
is inside lib. 

Pretty sure I followed everything right, but perhaps there's something in this 
chain I'm missing.  

Original comment by AaronAl...@gmail.com on 17 Jun 2011 at 5:52

GoogleCodeExporter commented 9 years ago
I found that my issue was that I copied the files into the standard lib/ 
directory. Turns out you need the files in the libs/ directory. I also copied 
the libjni*.so files both into the root armeabi direcotory as well as 
armeabi/com/googlecode/javacv/cpp/android-arm. Of course you probably only need 
one, but I was in a rush and haven't figure out which one yet.

My directory looks like this:

$ ls -R  libs/

libs/:
armeabi  javacpp.jar  javacv.jar

libs/armeabi:
com                      libjniopencv_features2d.so  libopencv_contrib.so
libjniARToolKitPlus.so   libjniopencv_flann.so       libopencv_core.so
libjniavcodec.so         libjniopencv_highgui.so     libopencv_features2d.so
libjniavdevice.so        libjniopencv_imgproc.so     libopencv_flann.so
libjniavfilter.so        libjniopencv_legacy.so      libopencv_gpu.so
libjniavformat.so        libjniopencv_ml.so          libopencv_highgui.so
libjniavutil.so          libjniopencv_objdetect.so   libopencv_imgproc.so
libjnicvkernels.so       libjniopencv_video.so       libopencv_legacy.so
libjniopencv_calib3d.so  libjnipostproc.so           libopencv_ml.so
libjniopencv_contrib.so  libjniswscale.so            libopencv_objdetect.so
libjniopencv_core.so     libopencv_calib3d.so        libopencv_video.so

libs/armeabi/com/googlecode/javacv/cpp/android-arm:
libjniARToolKitPlus.so  libjniopencv_calib3d.so     libjniopencv_legacy.so
libjniavcodec.so        libjniopencv_contrib.so     libjniopencv_ml.so
libjniavdevice.so       libjniopencv_core.so        libjniopencv_objdetect.so
libjniavfilter.so       libjniopencv_features2d.so  libjniopencv_video.so
libjniavformat.so       libjniopencv_flann.so       libjnipostproc.so
libjniavutil.so         libjniopencv_highgui.so     libjniswscale.so
libjnicvkernels.so      libjniopencv_imgproc.so

Original comment by icymidni...@gmail.com on 17 Jun 2011 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by samuel.a...@gmail.com on 20 Jun 2011 at 6:00