parameters: (context, filepath, scale)
docstring: Read a camera from a KRTD file and construct a blender camera object
docstring_summary: Read a camera from a KRTD file and construct a blender camera object
docstring_tokens: Read a camera from a KRTD file and construct a blender camera object
function: def readCamera(context, filepath, scale):
      """Read a camera from a KRTD file and construct a blender camera object
      """
      with open(filepath, 'r') as f:
          (K, R, t, d) = parseCameraKrtd(f)
          t = scale * t
          cam = bpy.data.cameras.new("camera_KRTD")
          cam_ob = bpy.data.objects.new("KRTD", cam)
          cam_ob.matrix_world = mathutils.Matrix.Translation(t) * R.to_4x4()
          bpy.context.scene.objects.link(cam_ob)
          if K[0][2] != 0.0:
              cam_ob.data.lens = K[0][0] / (2.0 * K[0][2]) \
                                 * cam_ob.data.sensor_width
              cam_ob.data.sensor_fit = 'HORIZONTAL'
              bpy.context.scene.render.resolution_x = 2.0 * K[0][2]
              bpy.context.scene.render.resolution_y = 2.0 * K[1][2]
function_tokens: def readCamera ( context , filepath , scale ) : with open ( filepath , 'r' ) as f : ( K , R , t , d ) = parseCameraKrtd ( f ) t = scale * t cam = bpy . data . cameras . new ( "camera_KRTD" ) cam_ob = bpy . data . objects . new ( "KRTD" , cam ) cam_ob . matrix_world = mathutils . Matrix . Translation ( t ) * R . to_4x4 ( ) bpy . context . scene . objects . link ( cam_ob ) if K [ 0 ] [ 2 ] != 0.0 : cam_ob . data . lens = K [ 0 ] [ 0 ] / ( 2.0 * K [ 0 ] [ 2 ] ) * cam_ob . data . sensor_width cam_ob . data . sensor_fit = 'HORIZONTAL' bpy . context . scene . render . resolution_x = 2.0 * K [ 0 ] [ 2 ] bpy . context . scene . render . resolution_y = 2.0 * K [ 1 ] [ 2 ]