How to get to work with the image of the camera with python

I'm moving the camera around an object all with python script. Now I want to get the image from the camera and work with it (some image processing) and then save it..Etc

Now I'm just rendering the view like so:

for po in positions:
scene.frame_set(number_of_frame)
cam_ob.location = po
cam_ob.keyframe_insert(data_path="location", index=-1)
bpy.data.scenes["Scene"].render.filepath = '/home/shot_%d.jpg'%number_of_frame
number_of_frame += 1


Anyone has done that before? I just want to get the image as a variable (matrix or array) to process it.

• I'm working on it: blender.stackexchange.com/questions/128174/… – bluejayke Jan 10 '19 at 4:19
• @user2016831 oh great I'll follow your post, please keep us updated Thanks – Ja_cpp Jan 10 '19 at 15:36
• Hi, cool, yeah I've been looking for people to help out but almost no one is even seeing the post.. I almost got it working, though. In fact, the code posted in the question in the link at EDIT 4 actually does exactly this, if you keep the WIDTH and HEIGHT at 512 and 256, you can try it out (although you have to install PIL and for the numpy array thing to go faster you'd have to make a custom blender build for now), so the only problem is getting a better resolution.. you're able to use a scale_x variable in the calc_camera_matrix function then change the width and height, but it... – bluejayke Jan 10 '19 at 21:55
• ...just pixelates it instead of actually getting a bigger image, like what the render function does.... SO there might be something to change in the source code, if we work together maybe we can figure it out (although seemingly there should just be a python way to do this), – bluejayke Jan 10 '19 at 21:57
• check this out for starers, its where I based the basics of my code off: docs.blender.org/api/blender2.8/… – bluejayke Jan 10 '19 at 21:59