android show rectangle on camera

2019-03-17 00:38发布

问题:

Hi I want to show a rectangle in camera so that when the user takes snap only the region inside the rectangle can be processed. Any idea how can I do it? And the rectangle size can be resized by dragging along the corners.

I am not calling the camera application. I am using the camera API.

回答1:

Hi I solved the problem using this tutorial, see here If the link goes missing some day I have kept a pdf here



回答2:

You can see my open source application http://code.google.com/p/android-palmprint-api , in SVN you can see the source code.



回答3:

I think you need to draw a rectangle that has size as you desire. Then you just need to set that size for preview frame, and when you get the result return from onPreviewFrame , you will process on that data. You can refer the ViewfinderView class of Xzing source here to learn how to draw a rectangle in camera preview. and refer CameraConfigurationManager,PreviewCallback,CameraManager also in xzing source to learn how to set preview size and process result data return from camera driver. Hope this help you.