himanshukandwal / javacv

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

IplImage cannot be used in android #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Initialise IplImage
2.
3.

What is the expected output? What do you see instead?
I want to do cvWarpPerspective on an image from the gallery.But it gives an 
exception saying java.awt.bufferedimage cannot be found

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by vishakh...@gmail.com on 31 Aug 2011 at 12:46

GoogleCodeExporter commented 8 years ago
This "ERROR" is just a warning. You problem must be elsewhere... Let me know 
more details when you have some

Original comment by samuel.a...@gmail.com on 1 Sep 2011 at 1:48

GoogleCodeExporter commented 8 years ago
I am assuming your issue has been resolved, whatever the cause was, but please 
let me know if this is not the case.

Original comment by samuel.a...@gmail.com on 6 Oct 2011 at 12:43

GoogleCodeExporter commented 8 years ago
Sorry sir,I couldn't find any solutions for my problem.So I almost gave up my 
project.I want to use wrapperspective on an image loaded from my gallery.Is 
there any other method without using IplImage?

Original comment by vishakh...@gmail.com on 6 Oct 2011 at 7:06

GoogleCodeExporter commented 8 years ago
From/to Android Bitmap objects? You can copy them to IplImage, but JavaCV 
doesn't provide handy methods for those, no. This is issue #67. You will find 
answers on how to do it manually there

Original comment by samuel.a...@gmail.com on 6 Oct 2011 at 8:02

GoogleCodeExporter commented 8 years ago
But IplImage object is not created due to the above error.

Original comment by vishakh...@gmail.com on 6 Oct 2011 at 12:55

GoogleCodeExporter commented 8 years ago
Like I said, this is *not* an error. Your IplImage will get created even if you 
get that message.

Original comment by samuel.a...@gmail.com on 6 Oct 2011 at 1:01

GoogleCodeExporter commented 8 years ago
10-06 20:19:34.611: ERROR/dalvikvm(280): Could not find class 
'java.awt.image.BufferedImage', referenced from method 
com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage

10-06 20:19:34.601: ERROR/dalvikvm(280): Could not find class 
'java.awt.Rectangle', referenced from method 
com.googlecode.javacv.cpp.opencv_core$IplImage.copyTo

10-06 20:19:34.611: ERROR/dalvikvm(280): Could not find class 
'java.awt.image.ComponentColorModel', referenced from method 
com.googlecode.javacv.cpp.opencv_core$IplImage.getBufferedImage

Original comment by vishakh...@gmail.com on 6 Oct 2011 at 2:52

GoogleCodeExporter commented 8 years ago
Android does not come with the class java.awt.image.BufferedImage so it is 
normal that IplImage.getBufferedImage() does not work. As I said, ideally we 
would need something like IplImage.getAndroidBitmap(), but this is not 
available at this moment. Again, please refer to issue #67.

Original comment by samuel.a...@gmail.com on 7 Oct 2011 at 12:38

GoogleCodeExporter commented 8 years ago
I am attaching the source code.Please check it if it can be corected.......
The lib folder in my project has the following files........
D:\eclipse_code\Android_workspace1\warp\libs\javacpp
D:\eclipse_code\Android_workspace1\warp\libs\javacv
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_calib3d.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_video.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_objdetect.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_legacy.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_ml.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_imgproc.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_highgui.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_features2d.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_flann.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_core.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\libopencv_contrib.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniavcodec.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniARToolKitPlus.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniavdevice.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniavformat.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjnicvkernels.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniavutil.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_calib3d.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_contrib.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_features2d.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_core.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_flann.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_highgui.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_legacy.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_imgproc.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_ml.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_objdetect.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjnipostproc.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniopencv_video.so
D:\eclipse_code\Android_workspace1\warp\libs\armeabi\com\googlecode\javacv\cpp\a
ndroid-arm\libjniswscale.so

Original comment by vishakh...@gmail.com on 13 Oct 2011 at 12:23

Attachments:

GoogleCodeExporter commented 8 years ago
As explained in the README.txt file, all .so files have to be in (in your case):
    D:\eclipse_code\Android_workspace1\warp\libs\armeabi\
If you put them anywhere else, it will not work with Android. What you did 
would work with Java SE, but not Android.

Original comment by samuel.a...@gmail.com on 14 Oct 2011 at 12:25

GoogleCodeExporter commented 8 years ago
I'm trying to convert bitmap to IplImage too. But my code doesn't works.

In the line:  IplImage image = IplImage.create(w, h, IPL_DEPTH_8U, 4); I have 
some errors. (I copy them at the end of this comment). I have the libraries 
javacpp.rar and javacv.rar on /libs/armeabi; and I don't know what can I do to 
solve it. Any idea?

thanks in advance.

01-20 01:26:00.241: ERROR/AndroidRuntime(3623): FATAL EXCEPTION: main
01-20 01:26:00.241: ERROR/AndroidRuntime(3623): 
java.lang.ExceptionInInitializerError
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.jni.colour.ColourTouch$1$1.onPreviewFrame(ColourTouch.java:195)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
android.hardware.Camera$EventHandler.handleMessage(Camera.java:346)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
android.os.Looper.loop(Looper.java:144)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
android.app.ActivityThread.main(ActivityThread.java:4937)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
java.lang.reflect.Method.invokeNative(Native Method)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
java.lang.reflect.Method.invoke(Method.java:521)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
dalvik.system.NativeStart.main(Native Method)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623): Caused by: 
java.lang.ExceptionInInitializerError
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
java.lang.Class.classForName(Native Method)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
java.lang.Class.forName(Class.java:235)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
java.lang.Class.forName(Class.java:182)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.googlecode.javacpp.Loader.load(Loader.java:291)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.googlecode.javacpp.Loader.load(Loader.java:271)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:145)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     ... 10 more
01-20 01:26:00.241: ERROR/AndroidRuntime(3623): Caused by: 
java.lang.NullPointerException
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.googlecode.javacpp.Loader.sizeof(Loader.java:426)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:1054)
01-20 01:26:00.241: ERROR/AndroidRuntime(3623):     ... 16 more

Original comment by rafegasf...@gmail.com on 14 Oct 2011 at 9:47

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have seen a Note of eclipse on IplImage:

com.googlecode.javacv.cpp.opencv_core.IplImage

Note: This element neither has attached source nor attached Javadoc and hence 
no Javadoc could be found.

This is why  IplImage image = IplImage.create(w, h, IPL_DEPTH_8U, 4) dosen't 
work? which is the solution?

thanks in advance.

Original comment by rafegasf...@gmail.com on 14 Oct 2011 at 3:46

GoogleCodeExporter commented 8 years ago
Thank you Sir........that solves my problem.....But then another one.What are 
the inputs to cvmat method......?

Original comment by vishakh...@gmail.com on 18 Oct 2011 at 6:53

GoogleCodeExporter commented 8 years ago
@rafegasf, you need to include all the .so files as indicated in the README.txt 
file. JavaCV does not come with a Javadoc, so you are getting a Note about 
that... what are you worried about?

@vishakh, what kind of inputs are you looking for?

Your questions have nothing to do with this issue. Please post your questions 
on the mailing list, thank you.

Original comment by samuel.a...@gmail.com on 19 Oct 2011 at 8:05

GoogleCodeExporter commented 8 years ago
Hello sir

I have to record video in flv format in andoid can u get me code for that?

thanx

Original comment by goyal.ar...@gmail.com on 12 Sep 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Hi,

I was hoping someone might help me in regards to solving one of the errors that 
was detailed above. 
I am hoping to use JavaCV for a project, and I am testing it out initially 
using the RecordActivity.java example 
(https://code.google.com/p/javacv/source/browse/samples/RecordActivity.java). I 
am also getting the error:

03-11 20:46:14.563: E/AndroidRuntime(677): FATAL EXCEPTION: main
03-11 20:46:14.563: E/AndroidRuntime(677): java.lang.ExceptionInInitializerError
03-11 20:46:14.563: E/AndroidRuntime(677):  at 
com.googlecode.javacv.recordactivity.RecordActivity.initRecorder(RecordActivity.
java:248)

which points to the line containing: 

yuvIplimage = IplImage.create(imageWidth, imageHeight,IPL_DEPTH_8U, 3);

This makes me think that I'm getting the error from creating the IplImage 
object. I see that above you've said that the IplImage issue could be a warning 
and not an error, but my android application stops working every time at this 
line and with the above error. I have copied RecordActivity.java, 
AndroidManifest.xml and activity_record.xml directly from the information given 
in the .java file.

I've loaded all the *.so files directly into the libs/armeabi folder, and 
included javacv.jar and javacpp.jar in the libs folder and build path. I've 
also added all the .jar files in the CLASSPATH in the system variables on my 
computer. I hope someone can help with this issue, under some time pressure 
with my project now! Thanks

Original comment by stuart.r...@gmail.com on 11 Mar 2013 at 9:02

GoogleCodeExporter commented 8 years ago
@stuart Yes, that probably means the libraries are missing from your app. 
Please try to uninstall and reinstall *everything* related to your application 
and the Android SDK. That usually does the trick for Android. And please ask 
your questions on the mailing list next time if possible, thank you.

Original comment by samuel.a...@gmail.com on 12 Mar 2013 at 1:25