Question

Is it possible to just capture the image, but not saving it and instead use right away the bitmap captured to do image processing techniques.

My point is, its much easier than reading the saved file, then converting it to a bitmap for usage in image processing.

I've implemented the built-in camera in android.

Était-ce utile?

La solution

Here is what I would do.

   protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK)
        {
            Uri pictureUri = data.getData();
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), pictureUri);

getContentResolver().delete(Utils.pictureUri, null, null);
        }
    }

Here what I did was create a Bitmap object to hold the current image. Once you get it in bitmap. You can delete the the file. I have not tried this but I think this is what you are trying to achieve.

Autres conseils

The MediaStore.ACTION_IMAGE_CAPTURE intent saves the captured picture to disk. Often, the intent allows you to choose the directory where the captured image will be stored. You can try to use /dev/null, but YMMV. Please remember that the bitmap that the intent returns to your onActivityResult() is a small thumbnail, intended to be displayed in a list of images. If you want access to reasonable resolution, you either need to read the saved file, or implement a custom camera. Note that for many purposes you don't need to capture a picture at all, some preview frame may be enough. Most current devices support VGA (640x480) preview, and many modern devices support up 1920x1080 preview resolution.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top