2012-12-05 48 views
2

我想修改「OpenCV Tutorial 1 - 添加OpenCV」以捕獲圖像並將其保存在圖庫中。我如何實現這一目標?OpenCV Android Camera Capture

我的主要目標是捕獲一個幀,將OpenCV函數應用到它,然後將它保存在手機中。

我可以做的OpenCV功能,但不是捕獲幀的一部分。

回答

1

我發現使用本機相機非常棘手。最簡單的方法是使用Camera Intent使用普通手機攝像頭拍攝圖像。 捕獲完圖像後,您可以將它們發送給OpenCV進行處理和保存。

因此,在僞代碼:

Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(i, 0); 

// In your activity 
public void onActivityResult(Intent data, int requestCode, int resultCode){ 
    // grab the image from the 'data' returned 

    // send the image to your opencv classes for processing and saving 
}