How to convert images to video in android using javacv?

I want to convert sdcard images to video in android. After many searches that I found, it is possible in javacv.when I try a simple javacv sample in pure java, it works fine in my eclipse.but, when I go to android, the same sample does not start in android.i to load and adding all .jar and .so files to the myproject-> libs / armeabi folder.my project no errors are displayed. but the error is encrypted at runtime.

I try with this class,

package com.example.ndkfoo_sample; import static com.googlecode.javacv.cpp.opencv_core.cvReleaseImage; import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage; import static com.googlecode.javacv.cpp.opencv_highgui.cvShowImage; import static com.googlecode.javacv.cpp.opencv_highgui.cvWaitKey; import static com.googlecode.javacv.cpp.opencv_imgproc.CV_GAUSSIAN; import static com.googlecode.javacv.cpp.opencv_imgproc.cvSmooth; import com.googlecode.javacv.cpp.opencv_core.IplImage; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { // @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); IplImage img=cvLoadImage("helloworld.jpg"); cvShowImage("/mnt/sdcard/helloworld",img); cvSmooth(img,img,CV_GAUSSIAN,13); cvShowImage("Blur-Image",img); cvWaitKey(); cvReleaseImage(img); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } 

My mistake is like

  opencv error unspecified error. 

My question is how to integrate opencv / javacv into android.is are there any steps or tutorials.?

thanks,

+6
source share
1 answer

Use the following lines.

**

 opencv_core.IplImage img = cvLoadImage("/sdcard/folder/img1.jpg"); FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("/sdcard/folder/test.mpeg",200,150); try { recorder.setCodecID( CODEC_ID_MPEG1VIDEO); recorder.setFrameRate(30); recorder.setPixelFormat( PIX_FMT_YUV420P); recorder.start(); for (int i=0;i<100;i++) { recorder.record(image[x]); } recorder.stop(); } catch (Exception e){ e.printStackTrace(); } 

** This is supported by the javacv library. read the Javacv Readme.txt file for more details. Hope this helps you.

+8
source

All Articles