Wednesday, March 6, 2013

[android-developers] JavaCV Integration with Android

I'm following complete instruction from here.According to instruction created libs/armeabi folder and copied javacpp.jar and javacv.jar into libs folder.Extracted all the *.so files from javacv-android-arm.jarBut I'm unable to find opencv-2.4.4-android-arm.jar, and ffmpeg-1.1.3-android-arm.jarfiles,also added both javacpp.jar and javacv.jar in Java Build Path.
Code:
public class ImageGrabe extends Activity {        @Override      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.activity_image_grabe);          grabeImg();      }        private void grabeImg() {          // TODO Auto-generated method stub          // Path is the path to your .3gp or whatever file on your sdcard          FrameGrabber f = new FFmpegFrameGrabber("/mnt/sdcard/android.3gp");          try {              f.start();          } catch (Exception e1) {              // TODO Auto-generated catch block              e1.printStackTrace();          }          // We need to convert from 3 channels to 4 channels so that we can          // convert          // from IplImage to Bitmap          IplImage grabbedImage = null;          try {              grabbedImage = f.grab();          } catch (Exception e) {              // TODO Auto-generated catch block              e.printStackTrace();          }          int width = grabbedImage.width();          int height = grabbedImage.height();          IplImage image = IplImage.create(width, height, IPL_DEPTH_8U, 4);          // source, dest, code          // cvCvtColor(grabbedImage, image, CV_BGR2GRAY);          cvCvtColor(grabbedImage, image, CV_BGR2GRAY);            int width1 = image.width();          int height1 = image.height();          Bitmap b = Bitmap.createBitmap(width1, height1, Config.ARGB_8888);          // Make sure you use getByteBuffer()!          b.copyPixelsFromBuffer(image.getByteBuffer());          // MAKE SURE YOU DO NOT CALL stop() BEFORE YOU CREATE A BITMAP FROM          // IMAGE          try {              f.stop();          } catch (Exception e) {              // TODO Auto-generated catch block              e.printStackTrace();          }      }  }
Error:
E/AndroidRuntime(  385): java.lang.NoClassDefFoundError: com.googlecode.javacv.FFmpegFrameGrabber
So Please any suggest me where I'm doing wrong and I havenot got two jar files so if someone have please provide.

--
Thanks & Regards

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment