Domanda

how can I load bitmap into FFmpegFrameRecorder? My old code loaded it from SD card and now I wish to put id directly. I use javacv.

FFmpegFrameRecorder recorder = new  FFmpegFrameRecorder(Environment.getExternalStorageDirectory().getPath()+ "/MyApp/Media/test-ffmep.mp4", w, h);
public void offerEncoder(Bitmap input) 
{
    recorder.record(opencv_highgui.cvLoadImage(input));
    //recorder.record(opencv_highgui.cvLoadImage("/sdcard/MyApp/Media/" + input + ".bmp")); //input was string
}
È stato utile?

Soluzione

Both bitmap and IplImage can be converted to a bytearray. Both of them support the bytearray interconversion. Then you can use Bitmap.copyPixelsFromBuffer or copyPixelsToBuffer accompanied with IplImage.getByteBuffer().

The thing to keep in mind is, Bitmap is 4 channeled and so should be the IPL-Image.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top