How can I set boundaries for a custom Android camera?
I am trying to get a region of the Android camera demarcated for a picture (as in the image below). I want only the marked area to appear in the picture.
How can I create a custom camera that shows the marked region when I open the camera (within my app)?
How can I take a picture only of the marked area?
Since the SurfaceView takes more space than you inner-rectangle, you'll have to crop the obtained image.
Returns an immutable bitmap from the specified subset of the source bitmap. The new bitmap may be the same object as source, or a copy may have been made. It is initialized with the same density as the original bitmap.
Pass it a bitmap, and define the rectangle from which the new bitmap will be created:
// Take 42 pixels off 4 sides Bitmap croppedBmp = Bitmap.createBitmap(originalBmp, 42, 42, originalBmp.getWidth() - 42, originalBmp.getHeight() - 42);