Og Namdik
Og Namdik

Reputation: 823

OpenCV Android Camera Capture

I want to modify "OpenCV Tutorial 1 - Add OpenCV" from to capture images and save it at the Gallery. How do I achieve this?

My main goal is to capture a frame, apply OpenCV functions to it, and then save it in the phone.

I can do the OpenCV functions but not the capture frame part.

Upvotes: 2

Views: 2171

Answers (1)

Entreco
Entreco

Reputation: 12900

I found using the Native Camera quite tricky. The easiest way is to capture the images using the normal phone camera using the Camera Intent. After you have captured the image, you can send them off to OpenCV for processing and saving.

So in pseudocode:

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
}

Upvotes: 1

Related Questions