0

i want to get information about sensor size on android device. how do it? or how to measure camera sensor size ,if we know focal length of camera? please help he

mr_kikuk
  • 1
  • 1
  • You don't understand: There is no method to measure sensor size. (I write it here because you asked that on every given Answer) – ArcDare Jan 19 '12 at 11:37

4 Answers4

1

It's easy to get width and height of the sensor of the camera with Camera1 Api too. Get horizontal and vertical angle of views and focal length and the rest is little trigonometry.

Camera.Parameters params = mCamera.getParameters();
focalLength = params.getFocalLength();
horizontalViewAngle = params.getHorizontalViewAngle();
verticalViewAngle = params.getVerticalViewAngle();

A = Angle of view, l = focal length, h = sensor height/2 => tan(A/2) = h/l

For my device with focal length 1.15 mm and horizontal angle of view 54.8 degrees:

Sensor width = tan(54.8/2)*2*1.15 = 1.19mm

Thracian
  • 43,021
  • 16
  • 133
  • 222
  • hehe, h and v ange are the same for my camera) I hope it's really true values) – user25 Mar 13 '17 at 02:52
  • do you mean `Sensor height/width = tan(A/2) * l` But what is 2 digit doing in your example - _tan(54.8/2)*_**2**_*1.15_ ? – user25 Mar 13 '17 at 14:46
  • No, what i wrote is correct. 2 is there, because you must use half of the sensor height or width. Check out [this link](https://petapixel.com/2013/06/15/a-mathematical-look-at-focal-length-and-crop-factor/) – Thracian Mar 13 '17 at 16:24
  • google says it's `-2.7503439364`, not `1.19` for your example `tan(54.8/2)*2*1.15` what am I doing wrong – user25 Mar 13 '17 at 20:52
  • You are taking tangent of 54.8/2 in radians. It's in degrees. Have you checked the link? To find tangent of an angle it basically needs to be angle in a right angle triangle. It's basic math, that's why you use half angle and half height. You can check this with other method for api 21 and above. And check math using windows calculator in scientific mode. – Thracian Mar 14 '17 at 02:24
  • got it, I checked this method to calculate sensor size and also checked SENSOR_INFO_PHYSICAL_SIZE (API 21), both gave me the same result on Xiaomi with 6 Android, thank you again, I thought deprecated `Camera.open()` won't work on Android 6 and I won't be able to compare two methods, but it worked – user25 Mar 14 '17 at 14:42
0

It is possible with API 21 and higher, see documentation: https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#SENSOR_INFO_PHYSICAL_SIZE

You can see also How to get Camera Sensor Size in android device?.

Community
  • 1
  • 1
Poiana Apuana
  • 1,406
  • 1
  • 10
  • 16
0

if you want to know about camera focal length : you can use the below code: public float getFocalLength (){ }

you can find more on Developer.Android camera

NovusMobile
  • 1,813
  • 2
  • 21
  • 48
0

If you're talking about the physical size of its sensors, I daresay it's not possible to know just by asking the OS. You will have to do a research looking for the specific sensor it has and then looking for its specs (and i don't think that will be easy).

ArcDare
  • 3,106
  • 4
  • 27
  • 38