Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-Focus: select focus point

Tags:

android

The camera app that comes with the HTC Desire HD allows the user to touch the screen at the point they wish focus on; a bounding indicator comes up around the area and the auto-focus does its magic. Thus a captured image can have a far point in the top right and a near point in the bottom left, with the user able to select which of these is in focus before taking the picture.

I've been asked to create an app that allows the user to select the region of interest after a picture is taken, obviously it would be good for this region to be in focus before taking the picture as described above.

My app so far does the auto-focus thing on the centre of the image but I can find no reference to selecting the region to focus on in any documentation. Any ideas.

like image 263
JayS Avatar asked Apr 06 '11 16:04

JayS


People also ask

What is Auto focus point selection?

AF point selection button. In this way you can very easily, quickly and accurately select exactly what part of your scene or subject you want in sharp focus, but still place it wherever you want in the shot.


1 Answers

What you are requesting is manual focusing.

To do this with the help of Android SDK's alone is not possible as of today. You will need to set the focal length on the camera. But if you see the Camera SDK for android then you would have noticed there is an API to get the focal point but not to set it.

All the market apps that tell it is performing manual focus is not true, you can run your simple experiment to check this. Keep a far and near object in the camera preview and sequentially try to focus the far and near object, when the focus is on the far object then the near object should be blurred and when the focus is on the near object then the far object should be blurred.. which will not happen with the market apps. (I have tried a couple, if you find one which truly does this then do let me know :) )

But if you are doing an OEM app (Where you have the buildable BSP with you for the device) then yes it is possible to do this (As the app that you have mentioned does). And this is how they do it (Note - These steps might not be comprehensive but it will give you idea..)

  • When the user taps the preview surface the coordinates are obtained (The box area.)
  • This is then feed to a focusing algo which basically does
    • Takes the box area and preview data
    • Tries to find the edges within the preview data
    • Adjusts the focal length to get sharper edges (This is when you can see in the preview that some zoom is happening)
    • It figures out the best focal length which gives it sharp edges in the box and returns
  • Now the app says it is focused and voila the manual focus has been achieved.
like image 54
bluefalcon Avatar answered Oct 05 '22 05:10

bluefalcon