Change BG image according with selected camera Hello, i’ve got a scene made with photogrammetry. Over 50 cameras from over 50 photos. I need to refine the geometry in the scene.
here is a screenshot from newtek lightwave.
another screen from blender https://yadi.sk/d/Ewkalb23WUjzf
i’ve got a whole bunch of scenes like this.
and i need a quick and simple way to change the view of the scene.
Change camera and change bg photo
Macro should do 2 simple things
Find a name of active camera
Change Bg item in accordance to the naming convention (undist_+(camera_name).jpg)
This should do the trick, if you have just one background image and all the relevant images have been loaded into blender.
import bpy
def find_3dview_space():
# Find 3D_View window and its scren space
for a in bpy.data.window_managers[0].windows[0].screen.areas:
if a.type == 'VIEW_3D':
area = a
break
space = area.spaces[0]
return space
o = bpy.context.object # Reference active object
# Get active camera's name (active object, of type camera)
active_camera = ''
if o.type == 'CAMERA':
active_camera = o.name
if active_camera:
# Create filename according to convention
filename = "undist_%s.jpg" % active_camera
space = find_3dview_space()
# Set background image
space.background_images[0] = bpy.data.images[ filename ]
I’ve been working on something for this very purpose. An add-on adapted from another Bundler import script.
Essentially it takes camera data generated by VSFM and translates it into an animated Blender camera with a sequence of images as the background… ignoring the point clouds, allowing for manual modeling… or at least that’s my goal.
I’m running into some issues lining up the data, or specifically the animated camera’s position, rotation and FOV, but I think the concept is sound… it’s just this math conversion is killing me. CloudCompare seems to have worked it out, but it’s been a long time since I’ve read C++ code, so adapting their logic into Python is proving to be… interesting. If anyone has any suggestions, I would not be insulted if they were offered.