Script to render one object from different angles I'm new to Blender. I'm currently working on a 3D reconstruction project using neural networks. I need to create my data set. Therefore I need to render a 3D body scan from different angles and save the images separately. I can render creating cameras manually but once i create a loop for the cameras my output is black images.
this is the code i used: 

bpy.ops.object.camera_add(view_align=False, location=[0,10,20], rotation=[0.436,0,pi])
bpy.ops.object.camera_add(view_align=False, location=[10,20,30], rotation=[0.436,0,pi])



for ob in scene.objects:
    if ob.type == 'CAMERA':
        bpy.context.scene.camera = ob
        print('Set camera %s' % ob.name )
        file = os.path.join('/home/fotofinder/Downloads/tryrender/images', ob.name )
        bpy.context.scene.render.filepath = file
        bpy.ops.render.render( write_still=True ) 


If anyone can help to define the proper parameters for the cameras in order to always have the object in the image I would be grateful.
Could you take an approach something like this?


Create a mesh whose vertices are the desired viewpoint positions, around your body scan. (It's the sphere, in the illustration, named 'Viewpoints')
Create one camera, and assign it a 'Track To' constraint ('To': -Z, 'Up': Y) with the body scan as target




Run a script which keyframes the camera to each of the vertex locations in successive frames

import bpy

vp_obj = bpy.data.objects['Viewpoints']
cam_obj = bpy.data.objects['Camera']
vp_vs = vp_obj.data.vertices

bpy.context.scene.frame_start=1
bpy.context.scene.frame_end=len(vp_vs)

for (f,v) in enumerate(vp_vs,1):
    cam_obj.location = vp_obj.matrix_world * v.co
    cam_obj.keyframe_insert(data_path="location", frame=f)


.. and render the animation?