문제

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
}
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top