0

I'd like to project images on a wall using camera. Images, essentially, must scale regarding the distance between camera and the wall.

Firstly, I made distance calculations by using right triangle trigonometry(visionHeight * Math.tan(a)). It's not 100% exact but yet close to real values.

Secondly, knowing the distance we can try to figure out all panorama height by using isosceles triangle trigonometry formula: c = a * tan(A); A = mCamera.getParameters().getVerticalViewAngle(); The results are about 30% greater than the actual object height and it's kinda weird.

double panoramaHeight = (distance * Math.tan( mCamera.getParameters().getVerticalViewAngle() / 2 * 0.0174532925)) * 2;

I've also tried figuring out those angles using the same isosceles triangle's formula, but now knowing the distance and the height. I got 28 and 48 degrees angles.

Does it mean that android camera doesn't render everything it shoots ? And, what other solutions you can suggest ?

enter image description here

midnight
  • 3,420
  • 3
  • 36
  • 58

1 Answers1

0

Web search shows that the values returned by getVerticalViewAngle() cannot be blindly trusted on all devices; also note that you should take into account the zoom level and aspect ratio, see Determine angle of view of smartphone camera

Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • I measured the approximate angle by turning the camera's lower border of the panorama to the upper and then simply retrieving rotation matrix and orientation values delta(l. angle - u. angle). getVerticalViewAngle does everything correctly because it's value is related to camera's resolution - not display's. So, when I measured panoramaHeight and value seemed too big it was actually right - I just couldn't see the whole camera picture on my screen because my display doesn't have enough pixels to render everything camera supplies - so it simply cuts the image. It's an assumption, however. – midnight Oct 28 '12 at 07:13
  • I thought you were comparing height of a known object on the wall. But if you are looking at the whole picture, you face the tricks the camera does to support 16:9 (or, to be more precise, 800x480) preview. Many cameras, as described in the post [referred above](http://stackoverflow.com/questions/3261776/determine-angle-of-view-of-smartphone-camera), use 4:3 sensor and crop the result vertically. – Alex Cohn Oct 28 '12 at 08:40