1

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.

user3115201
  • 111
  • 2
  • 14
  • by _"built-in camera"_ you probably mean `MediaStore.ACTION_IMAGE_CAPTURE` intent, don't you? – Alex Cohn Feb 23 '14 at 11:26
  • yes i do alex cohn.. i think its a hassle to save then read that image. why cant i just grab the bitmap after taking with the built in camera? – user3115201 Feb 23 '14 at 12:17

2 Answers2

1

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.

1011
  • 121
  • 1
  • 15
0

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.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • hmm so there is no way that i can do what i want hmm.. i dont want to implement sa custom camera since using the MediaStore.ACTION_IMAGE_CAPTURE intent saves me the hassle of previewing to the user the captured image, rather than implementing a new activity with a surfaceview to preview the captured image.. are you suggesting that i should rather use a screenshot? how do i access the returned bitmap from the intent? maybe i can try to play with it.. – user3115201 Feb 23 '14 at 13:54
  • The intent returns `data`, which is a very coarse bitmap, see http://stackoverflow.com/questions/15399121/what-is-size-of-thumbnail-returned-by-action-image-capture-intent – Alex Cohn Feb 23 '14 at 14:53