def bvxm_detect_edges(cropped_image, edge_params_xml): batch.init_process("bvxmDetectEdgesProcess") batch.set_input_from_db(0, cropped_image) batch.set_params_process(edge_params_xml) batch.run_process() (cropped_edge_image_id, cropped_edge_image) = batch.commit_output(0) cropped_edge_image = dbvalue(cropped_edge_image_id, cropped_edge_image) return cropped_edge_image
def create_scene(scene_params_xml): batch.init_process("bvxmCreateVoxelWorldProcess") # "./bvxmCreateVoxelWorldProcess.xml" batch.set_params_process(scene_params_xml) status = batch.run_process() if status != 1: raise Exception('Error creating scene from ' + scene_params_xml) (world_id, world_type) = batch.commit_output(0) world = dbvalue(world_id, world_type) return world
def roi_init(image_filename, cam, world, roi_init_params_xml, is_all_bits=False): batch.init_process("bvxmRoiInitProcess") batch.set_input_string(0, image_filename) batch.set_input_from_db(1, cam) batch.set_input_from_db(2, world) batch.set_input_bool(3, is_all_bits) # "bvxmRoiInitProcess.xml") batch.set_params_process(roi_init_params_xml) statuscode = batch.run_process() if statuscode: (cropped_cam_id, cropped_cam_type) = batch.commit_output(0) cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type) (cropped_image_id, cropped_image_type) = batch.commit_output(1) cropped_image = dbvalue(cropped_image_id, cropped_image_type) (uncertainty_id, uncertainty_type) = batch.commit_output(2) uncertainty = dbvalue(uncertainty_id, uncertainty_type) return statuscode, cropped_cam, cropped_image, uncertainty else: return statuscode, dbvalue(0, ""), dbvalue(0, ""), dbvalue(0, "")
# assumes that ground-truth changes are marked as polygonal regions via tools in bwm_main and saved as binary files # by Ozge C. Ozcanli # 11/16/2008 import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() # number of images with correct cameras. num_cam = 2 normalize_and_save = 0 # first creat an empty world. print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./world_model_params.xml") bvxm_batch.run_process() voxel_world_id = bvxm_batch.commit_output(0) python_path = "./" change_type = "sewage" import os import shutil output_path = python_path + "testing_output/" # if os.path.exists(output_path): # shutil.rmtree(output_path); # os.mkdir(output_path); if os.path.exists(output_path) != 1: os.mkdir(output_path)
# Created by Vishal Jain # Nov 10, 2009 # LEMS, Brown University ############################################################################# import brl_init import bvxm_batch as batch dbvalue = brl_init.register_batch(batch) f = open('images.txt', 'r') image_fnames = f.readlines() f.close() print("Creating Voxel World") batch.init_process("bvxmCreateVoxelWorldProcess") batch.set_params_process("./bvxmCreateVoxelWorldProcess.xml") batch.set_input_string(1, "ocp_opinion") batch.run_process() (world_id, world_type) = batch.commit_output(0) world = dbvalue(world_id, world_type) for i in range(0, len(image_fnames), 1): image_fnames[i] = image_fnames[i].strip() batch.init_process("vpglLoadRationalCameraNITFProcess") batch.set_input_string(0, image_fnames[i]) batch.run_process() (cam_id, cam_type) = batch.commit_output(0) cam = dbvalue(cam_id, cam_type) batch.init_process("bvxmRoiInitProcess")
""" This is a sample script by Ozge C Ozcanli 02/19/2008 """ import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() print("Creating Voxel World") # clon CreateVoxelWorldProcess and make it the current process bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") # call the parse method of the current process bvxm_batch.set_params_process( "D:/projects/lockheed-voxel-world/CreateVoxelWorldProcess.xml") # run the current process bvxm_batch.run_process() world_id = bvxm_batch.commit_output(0) import glob image_fnames = glob.glob( "Z:/video/ieden/image_pvd_helicopter/seq2/images/*.png") camera_fnames = glob.glob( "Z:/video/ieden/image_pvd_helicopter/seq2/cameras/*.txt") print("Loading Camera") bvxm_batch.init_process("bvxmLoadProjCameraProcess") bvxm_batch.set_input_string(0, camera_fnames[1]) bvxm_batch.run_process() cam_id = bvxm_batch.commit_output(0)
# by Ozge C. Ozcanli # 11/16/2008 import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() # number of images with correct cameras. num_cam = 2 normalize_and_save = 0 # first creat an empty world. print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./world_model_params.xml") bvxm_batch.run_process() voxel_world_id = bvxm_batch.commit_output(0) python_path = "./" change_type = "sewage" import os import shutil output_path = python_path + "testing_output_rec/" if os.path.exists(output_path) != 1: os.mkdir(output_path) # list of the images f = open("testing_images.txt", 'r')
import bvxm_batch bvxm_batch.register_processes(); bvxm_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string f=open('images.txt', 'r') image_fnames=f.readlines(); f.close(); print("Creating Voxel World"); bvxm_batch.init_process("bvxmCreateVoxelWorldProcess"); bvxm_batch.set_params_process("./bvxmCreateVoxelWorldProcess.xml"); bvxm_batch.set_input_string(1,"ocp_opinion"); bvxm_batch.run_process(); (world_id,world_type)= bvxm_batch.commit_output(0); world = dbvalue(world_id,world_type); for i in range(0,len(image_fnames),1): image_fnames[i] = image_fnames[i].strip(); bvxm_batch.init_process("vpglLoadRationalCameraNITFProcess"); bvxm_batch.set_input_string(0,image_fnames[i]); bvxm_batch.run_process(); (cam_id,cam_type)=bvxm_batch.commit_output(0); cam = dbvalue(cam_id,cam_type); bvxm_batch.init_process("bvxmRoiInitProcess");
import bvxm_batch as batch dbvalue = brl_init.register_batch(batch) python_path = "./" #voxel_world_path = "./edges_0.vox"; num_train = 20 skip_list = [8, 14, 15, 18, 23, 29] # printing the database batch.print_db() # first creat an empty world. print("Creating Voxel World") batch.init_process("bvxmCreateVoxelWorldProcess") batch.set_params_process("./world_model_params.xml") batch.run_process() voxel_world_id = batch.commit_output(0) # list of the images f = open('./full_hiafa_images.txt', 'r') image_fnames = f.readlines() f.close() # list of corrected cameras f = open('./full_hiafa_cam.txt', 'r') cam_fnames = f.readlines() f.close() # number of images used to compute the voxel grid to correct the cameras. num_train = 5
import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() python_path = "./" # number of images used to compute the voxel grid to correct the cameras. num_train = 5 # first creat an empty world. print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./world_model_params.xml") bvxm_batch.run_process() voxel_world_id = bvxm_batch.commit_output(0) ######################################## #LIDAR update print("Writing World") bvxm_batch.init_process("bvxmSaveOccupancyRaw") bvxm_batch.set_input_from_db(0, voxel_world_id) bvxm_batch.set_input_string(1, "./world.raw") bvxm_batch.run_process() print("Creating Lidar") bvxm_batch.init_process("bvxmLidarInitProcess") bvxm_batch.set_params_process("lidar_params.xml") bvxm_batch.set_input_string( 0, "E:/LIDAR/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif") bvxm_batch.set_input_string( 1, "E:/LIDAR/BaghdadLIDAR/dem_1m_a2_baghdad_tile39.tif")
import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() python_path = "./" # number of images used to compute the voxel grid to correct the cameras. num_train = 5 # first creat an empty world. print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./world_model_params.xml") bvxm_batch.run_process() voxel_world_id = bvxm_batch.commit_output(0) ######################################## # LIDAR update print("Writing World") bvxm_batch.init_process("bvxmSaveOccupancyRaw") bvxm_batch.set_input_from_db(0, voxel_world_id) bvxm_batch.set_input_string(1, "./world.raw") bvxm_batch.run_process() print("Creating Lidar") bvxm_batch.init_process("bvxmLidarInitProcess") bvxm_batch.set_params_process("lidar_params.xml") bvxm_batch.set_input_string( 0, "E:/LIDAR/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif") bvxm_batch.set_input_string( 1, "E:/LIDAR/BaghdadLIDAR/dem_1m_a2_baghdad_tile39.tif")
bvxm_batch.register_processes() bvxm_batch.register_datatypes() python_path = "./" #voxel_world_path = "./edges_0.vox"; num_train = 20 skip_list = [8, 14, 15, 18, 23, 29] # printing the database bvxm_batch.print_db() # first creat an empty world. print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./world_model_params.xml") bvxm_batch.run_process() voxel_world_id = bvxm_batch.commit_output(0) # list of the images f = open('./full_hiafa_images.txt', 'r') image_fnames = f.readlines() f.close() # list of corrected cameras f = open('./full_hiafa_cam.txt', 'r') cam_fnames = f.readlines() f.close() # number of images used to compute the voxel grid to correct the cameras. num_train = 5
import bvxm_batch bvxm_batch.register_processes() bvxm_batch.register_datatypes() class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string print("Creating Voxel World") bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process("./bvxmCreateVoxelWorldProcess.xml") bvxm_batch.run_process() (world_id, world_type) = bvxm_batch.commit_output(0) world = dbvalue(world_id, world_type) lidar_1st_image_original = "C:/test_images/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif" lidar_2nd_image_original = "C:/test_images/BaghdadLIDAR/dem_1m_a2_baghdad_tile39.tif" bvxm_batch.init_process("bvxmLidarInitProcess") bvxm_batch.set_input_string(0, lidar_1st_image_original) bvxm_batch.set_input_string(1, lidar_2nd_image_original) bvxm_batch.set_input_from_db(2, world) bvxm_batch.run_process() (lidar_camera_id, lidar_camera_type) = bvxm_batch.commit_output(0) lidar_camera = dbvalue(lidar_camera_id, lidar_camera_type) (lidar_1st_image_id, lidar_1st_image_type) = bvxm_batch.commit_output(1) lidar_1st_image = dbvalue(lidar_1st_image_id, lidar_1st_image_type) (lidar_2nd_image_id, lidar_2nd_image_type) = bvxm_batch.commit_output(2)
input_dir = "/Users/isa/Experiments/CapitolSFM/capitol_rotated" output_dir = "/Users/isa/Experiments/CapitolSFM/smaller_capitol" print("Load Grid World"); bvxm_batch.init_process("bvxmLoadGridProcess"); bvxm_batch.set_input_string(0,input_dir + "/KL_gaussf1.vox"); bvxm_batch.set_input_string(1,"bsta_gauss_f1"); bvxm_batch.run_process(); (world_id,world_type)= bvxm_batch.commit_output(0); world = dbvalue(world_id,world_type); print("Crop Voxel World"); bvxm_batch.init_process("bvxmCropGridProcess"); bvxm_batch.set_params_process(output_dir +"/crop_grid_params.xml"); bvxm_batch.set_input_from_db(0,world); bvxm_batch.set_input_string(1, output_dir +"/KL_gaussf1.vox"); bvxm_batch.run_process(); (crop_world_id,crop_world_type)= bvxm_batch.commit_output(0); crop_world = dbvalue(crop_world_id,crop_world_type); print("Writing World"); bvxm_batch.init_process("bvxmSaveGridRawProcess"); bvxm_batch.set_input_from_db(0,crop_world); bvxm_batch.set_input_string(1,output_dir + "/KL_gaussf1.raw"); bvxm_batch.run_process(); print("Load Grid World"); bvxm_batch.init_process("bvxmLoadGridProcess"); bvxm_batch.set_input_string(0,input_dir + "/MPM_gaussf1.vox");