cropCameraPreviewToViewFinder

fun cropCameraPreviewToViewFinder(cameraPreviewImage: Bitmap, previewBounds: Rect, viewFinder: Rect): Bitmap

Crop the preview image from the camera based on the view finder's position in the preview bounds.

Note: This algorithm makes some assumptions:

  1. the previewBounds and the cameraPreviewImage are centered relative to each other.

  2. the previewBounds circumscribes the cameraPreviewImage. I.E. they share at least one field of view, and the cameraPreviewImage fields of view are smaller than or the same size as the previewBounds

  3. the previewBounds and the cameraPreviewImage have the same orientation