How to get Camera Sensor Size in android device?

前端 未结 2 999
余生分开走
余生分开走 2021-01-05 05:13

can anyone know how to get sensor size of camera in android device ?

Thanks

2条回答
  •  爱一瞬间的悲伤
    2021-01-05 06:10

    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

    This value is same with what i get using method DomTomCat posted.

提交回复
热议问题