def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string # first creat an empty world. print("Load Voxel World") bvpl_batch.init_process("bvxmLoadGridProcess") bvpl_batch.set_input_string( 0, "D:/vj/scripts/Lidar_edges/ocp_bin_0_scale_0.vox") bvpl_batch.set_input_string(1, "float") bvpl_batch.run_process() (world_id, world_type) = bvpl_batch.commit_output(0) world = dbvalue(world_id, world_type) print("Crop Voxel World") bvpl_batch.init_process("bvxmCropGridProcess") bvpl_batch.set_params_process( "D:/vj/scripts/Lidar_edges/bvxmCropGridProcess.xml") bvpl_batch.set_input_from_db(0, world) bvpl_batch.run_process() (crop_world_id, crop_world_type) = bvpl_batch.commit_output(0) crop_world = dbvalue(crop_world_id, crop_world_type) print("Writing World") bvpl_batch.init_process("bvxmSaveGridRawProcess") bvpl_batch.set_input_from_db(0, crop_world) bvpl_batch.set_input_string(1, "D:/vj/scripts/Lidar_edges/crop_world.raw") bvpl_batch.set_input_string(2, "float") bvpl_batch.run_process()
bvpl_batch.run_process() (world_id, world_type) = bvpl_batch.commit_output(0) world = dbvalue(world_id, world_type) print("Creating 3D edge kernel") bvpl_batch.init_process("bvplCreateEdge3dKernelVectorProcess") bvpl_batch.set_input_unsigned(0, 2) bvpl_batch.set_input_unsigned(1, 5) bvpl_batch.set_input_unsigned(2, 5) bvpl_batch.run_process() (kernel_id, kernel_type) = bvpl_batch.commit_output(0) kernel = dbvalue(kernel_id, kernel_type) print("Running Operator") bvpl_batch.init_process("bvplVectorOperatorProcess") bvpl_batch.set_input_from_db(0, world) bvpl_batch.set_input_from_db(1, kernel) bvpl_batch.set_input_string(2, "opinion") bvpl_batch.set_input_string(3, "edge_algebraic_mean") bvpl_batch.set_input_string(4, cwd_dir + "response.vox") bvpl_batch.set_input_string(5, cwd_dir + "id_orientation.vox") bvpl_batch.run_process() (id, type) = bvpl_batch.commit_output(0) response_world = dbvalue(id, type) (id, type) = bvpl_batch.commit_output(1) id_orientation = dbvalue(id, type) # this is for visulaization print("Convert Voxel World") bvpl_batch.init_process("bvxmExpectationOpinionGridProcess") bvpl_batch.set_input_from_db(0, response_world)
(world_id,world_type)= bvpl_batch.commit_output(0); world = dbvalue(world_id,world_type); print("Creating corner 2d kernel"); bvpl_batch.init_process("bvplCreateCorner2dKernelVectorProcess"); bvpl_batch.set_input_unsigned(0, 3); #half length bvpl_batch.set_input_unsigned(1, 3); #half width bvpl_batch.set_input_unsigned(2, 1); #half thickness bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); kernel_vector = dbvalue(kernel_id,kernel_type); print("Running Kernels"); bvpl_batch.init_process("bvplSuppressAndCombineProcess"); bvpl_batch.set_input_from_db(0,world ); bvpl_batch.set_input_from_db(1,kernel_vector); bvpl_batch.set_input_string(2,"bsta_gauss_f1"); bvpl_batch.set_input_string(3,"gauss_convolution"); bvpl_batch.set_input_string(4, output_dir + "/KL_gaussf1_response.vox"); bvpl_batch.set_input_string(5, output_dir + "/KL_gaussf1_id.vox"); bvpl_batch.run_process(); (all_resp_grid_id,all_resp_grid_type)= bvpl_batch.commit_output(0); all_resp_grid = dbvalue(all_resp_grid_id,all_resp_grid_type); (all_id_grid_id,all_id_grid_type)= bvpl_batch.commit_output(1); all_id_grid = dbvalue(all_id_grid_id, all_id_grid_type); print("Getting top response"); bvpl_batch.init_process("bvplExtractTopResponseProcess"); bvpl_batch.set_input_from_db(0,all_resp_grid ); bvpl_batch.set_input_from_db(1,all_id_grid);
bvpl_batch.set_input_string(1,"vnl_vector_fixed_float_3"); bvpl_batch.run_process(); (grid_id,grid_type)= bvpl_batch.commit_output(0); orientation_grid = dbvalue(grid_id,grid_type); print("Load Voxel World"); bvpl_batch.init_process("bvxmLoadGridProcess"); bvpl_batch.set_input_string(0, data_dir + "/edge3d_alge.vox"); bvpl_batch.set_input_string(1,"float"); bvpl_batch.run_process(); (grid_id,grid_type)= bvpl_batch.commit_output(0); grid = dbvalue(grid_id,grid_type); print("Combine grids"); bvpl_batch.init_process("bvxmCombineGridsProcess"); bvpl_batch.set_input_from_db(0, orientation_grid ); bvpl_batch.set_input_from_db(1, grid ); bvpl_batch.set_input_string(2,data_dir + "/edge3d_combined.vox"); bvpl_batch.run_process(); (grid_id,grid_type)= bvpl_batch.commit_output(0); combined_grid = dbvalue(grid_id,grid_type); print("Creating 3D edge kernel"); bvpl_batch.init_process("bvplCreateEdge3dKernelVectorProcess"); bvpl_batch.set_input_unsigned(0, 5); #width bvpl_batch.set_input_unsigned(1, 5); #height bvpl_batch.set_input_unsigned(2, 5); #length bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); kernel_vector = dbvalue(kernel_id,kernel_type);
(world_id,world_type)= bvpl_batch.commit_output(0); world = dbvalue(world_id,world_type); print("Creating 3D edge kernel"); bvpl_batch.init_process("bvplCreateGauss3dXXKernelVectorProcess"); bvpl_batch.set_input_float(0, 1.5); #Sigma1 bvpl_batch.set_input_float(1, 2); #Sigma2 bvpl_batch.set_input_float(2, 2); #Sigma3 bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); kernel_vector = dbvalue(kernel_id,kernel_type); print("Converting Directions to Hue "); bvpl_batch.init_process("bvplConvertDirectionToHueProcess"); bvpl_batch.set_input_from_db(0,world ); bvpl_batch.set_input_from_db(1,kernel_vector); bvpl_batch.set_input_string(2, output_dir + "/gauss_xx_hue_c.vox"); bvpl_batch.set_input_string(3, output_dir + "/gauss_xx_hue_c.svg"); bvpl_batch.run_process(); (hue_grid_id,hue_grid_type)= bvpl_batch.commit_output(0); hue_grid = dbvalue(hue_grid_id,hue_grid_type); print("Writing Orientation Grid"); bvpl_batch.init_process("bvxmGridToImageStackProcess"); bvpl_batch.set_input_from_db(0,hue_grid); bvpl_batch.set_input_string(1,"vnl_vector_fixed_float_4"); bvpl_batch.set_input_string(2,output_dir + "/gauss_xx_raw_c"); bvpl_batch.run_process();
(response_grid_id,response_grid_type)= bvpl_batch.commit_output(0); response_grid = dbvalue(response_grid_id,response_grid_type); print("Load ID Grid"); bvpl_batch.init_process("bvxmLoadGridProcess"); bvpl_batch.set_input_string(0, data_dir + "/KL_gaussf1_id.vox"); bvpl_batch.set_input_string(1,"unsigned"); bvpl_batch.run_process(); (id_grid_id,id_grid_type)= bvpl_batch.commit_output(0); id_grid = dbvalue(id_grid_id,id_grid_type); if (non_max): print("Non-max suppression"); bvpl_batch.init_process("bvplNonMaxSuppressionProcess"); bvpl_batch.set_input_from_db(0,response_grid ); bvpl_batch.set_input_from_db(1,id_grid); bvpl_batch.set_input_from_db(2,kernel_vector); bvpl_batch.set_input_string(3, output_dir + "/non_max.vox"); bvpl_batch.run_process(); (non_max_id,non_max_type)= bvpl_batch.commit_output(0); non_max_grid = dbvalue(non_max_id,non_max_type); # print("Writing Response Grid"); # bvpl_batch.init_process("bvxmSaveGridRawProcess"); # bvpl_batch.set_input_from_db(0,response_grid); # bvpl_batch.set_input_string(1,output_dir + "/KL_gaussf1_response.raw"); # bvpl_batch.set_input_string(2,"float"); # bvpl_batch.run_process(); # print("Writing Non-Max Grid");
def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string #first creat an empty world. print("Load Voxel World") bvpl_batch.init_process("bvxmLoadGridProcess") bvpl_batch.set_input_string(0, "D:/vj/scripts/Lidar_edges/ocp_bin_0_scale_0.vox") bvpl_batch.set_input_string(1, "float") bvpl_batch.run_process() (world_id, world_type) = bvpl_batch.commit_output(0) world = dbvalue(world_id, world_type) print("Crop Voxel World") bvpl_batch.init_process("bvxmCropGridProcess") bvpl_batch.set_params_process( "D:/vj/scripts/Lidar_edges/bvxmCropGridProcess.xml") bvpl_batch.set_input_from_db(0, world) bvpl_batch.run_process() (crop_world_id, crop_world_type) = bvpl_batch.commit_output(0) crop_world = dbvalue(crop_world_id, crop_world_type) print("Writing World") bvpl_batch.init_process("bvxmSaveGridRawProcess") bvpl_batch.set_input_from_db(0, crop_world) bvpl_batch.set_input_string(1, "D:/vj/scripts/Lidar_edges/crop_world.raw") bvpl_batch.set_input_string(2, "float") bvpl_batch.run_process()
class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string print("Load Pair Grid") bvpl_batch.init_process("bvplLoadPairGridProcess") bvpl_batch.set_input_string(0, data_dir + "/pair_centers.vox") bvpl_batch.run_process() (id, type) = bvpl_batch.commit_output(0) pair_grid = dbvalue(id, type) print("Extract Response") bvpl_batch.init_process("bvplPairToFloatProcess") bvpl_batch.set_input_from_db(0, pair_grid) bvpl_batch.set_input_string(1, data_dir + "/pair_resp.vox") bvpl_batch.run_process() (id, type) = bvpl_batch.commit_output(0) float_grid = dbvalue(id, type) print("Writing Response Grid") bvpl_batch.init_process("bvxmSaveGridRawProcess") bvpl_batch.set_input_from_db(0, float_grid) bvpl_batch.set_input_string(1, data_dir + "/pair_resp.raw") bvpl_batch.run_process() # print("Load Voxel Grid"); # bvpl_batch.init_process("bvxmLoadGridProcess"); # bvpl_batch.set_input_string(0,data_dir + "/corners_top_resp.vox"); # bvpl_batch.set_input_string(1,"float");
bvpl_batch.set_input_string(1,"bsta_gauss_f1"); bvpl_batch.run_process(); (world_id,world_type)= bvpl_batch.commit_output(0); world = dbvalue(world_id,world_type); print("Creating corner 2d kernel"); bvpl_batch.init_process("bvplCreateCorner2dKernelProcess"); bvpl_batch.set_params_process(output_dir +"/corner2d_params.xml"); bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Running Operator"); bvpl_batch.init_process("bvplNeighborhoodOperatorProcess"); bvpl_batch.set_input_from_db(0,world ); bvpl_batch.set_input_from_db(1,kernel); bvpl_batch.set_input_string(2,"bsta_gauss_f1"); bvpl_batch.set_input_string(3,"positive_gauss_convolution"); bvpl_batch.set_input_string(4, output_dir + "/KL_gaussf1_response.vox"); bvpl_batch.run_process(); (response_grid_id,response_grid_type)= bvpl_batch.commit_output(0); response_grid = dbvalue(response_grid_id,response_grid_type); print("Writing Response Grid"); bvpl_batch.init_process("bvxmSaveGridRawProcess"); bvpl_batch.set_input_from_db(0,response_grid); bvpl_batch.set_input_string(1,output_dir + "/KL_gaussf1_response.raw"); bvpl_batch.run_process();
# Script to run find 2d corners on appearance grid # Author : Isabel Restrepo #8-31-2009 import bvpl_batch import time import os import sys #time.sleep(30); bvpl_batch.register_processes(); bvpl_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string find_corners = 1; load_corners = 0; pair_corners = 1; save_corners_vrml = 0; save_pairs_vrml = 0; save_centers_vrml = 0; corner_length = 3; corner_width = 3; corner_thickness =1; data_dir = sys.argv[1]; output_dir = sys.argv[2]; directions = sys.argv[3]; num_corners = int(sys.argv[4]); print("Data Dir"); print data_dir;
print("Creating kernels to search for corners"); bvpl_batch.init_process("bvplCreateWCKernelVectorProcess"); bvpl_batch.set_input_int(0, 0); #min length bvpl_batch.set_input_int(1, 5); #max length bvpl_batch.set_input_int(2, -5); #min width bvpl_batch.set_input_int(3, 0); #max width bvpl_batch.set_input_int(4, -2); #min thickness bvpl_batch.set_input_int(5, 2); #max thickness bvpl_batch.set_input_string(6, directions); bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); wc_kernel_vector = dbvalue(kernel_id,kernel_type); print("Pairing Pairs"); bvpl_batch.init_process("bvplFindPairsProcess"); bvpl_batch.set_input_from_db(0,pair_grid ); bvpl_batch.set_input_int(1, opposite_angle) bvpl_batch.set_input_from_db(2,wc_kernel_vector); bvpl_batch.set_input_string(3, output_dir + "/pair_centers.vox"); bvpl_batch.run_process(); (pairs_id,pairs_type)= bvpl_batch.commit_output(0); pairs = dbvalue(pairs_id,pairs_type); (pairs_id,pairs_type)= bvpl_batch.commit_output(1); pairs_grid = dbvalue(pairs_id,pairs_type); print("Extract Response"); bvpl_batch.init_process("bvplPairToFloatProcess"); bvpl_batch.set_input_from_db(0,pairs_grid); bvpl_batch.set_input_string(1, output_dir +"/pair_resp.vox"); bvpl_batch.run_process(); (id, type)= bvpl_batch.commit_output(0);
0, "D:/vj/scripts/Lidar_edges/ocp_200_100_0_250_200_100.vox") bvpl_batch.set_input_string(1, "float") bvpl_batch.run_process() (world_id, world_type) = bvpl_batch.commit_output(0) world = dbvalue(world_id, world_type) print("Creating 2D edge kernel") bvpl_batch.init_process("bvplCreateEdge2dKernelProcess") bvpl_batch.set_params_process("./edge2d_kernel_params.xml") bvpl_batch.run_process() (kernel_id, kernel_type) = bvpl_batch.commit_output(0) kernel = dbvalue(kernel_id, kernel_type) print("Running Operator") bvpl_batch.init_process("bvplNeighborhoodOperatorProcess") bvpl_batch.set_input_from_db(0, world) bvpl_batch.set_input_from_db(1, kernel) bvpl_batch.set_input_string(2, "float") bvpl_batch.set_input_string(3, "edge2d") bvpl_batch.set_input_string(4, "D:/vj/scripts/Lidar_edges/x_conv.vox") bvpl_batch.run_process() (result_x_world_id, result_x_world_type) = bvpl_batch.commit_output(0) result_x_world = dbvalue(result_x_world_id, result_x_world_type) print("Writing World") bvpl_batch.init_process("bvxmSaveGridRawProcess") bvpl_batch.set_input_from_db(0, result_x_world) bvpl_batch.set_input_string(1, "D:/vj/scripts/Lidar_edges/x_crop_world.raw") bvpl_batch.set_input_string(2, "float") bvpl_batch.run_process()
(world_id,world_type)= bvpl_batch.commit_output(0); app_grid = dbvalue(world_id,world_type); print("Creating corner 2d kernel"); bvpl_batch.init_process("bvplCreateCorner2dKernelVectorProcess"); bvpl_batch.set_input_unsigned(0, corner_length); #half length bvpl_batch.set_input_unsigned(1, corner_width); #half width bvpl_batch.set_input_unsigned(2, corner_thickness); #half thickness bvpl_batch.set_input_string(3, directions); bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); corners_kernel_vector = dbvalue(kernel_id,kernel_type); print("Running Kernels"); bvpl_batch.init_process("bvplSuppressAndCombineProcess"); bvpl_batch.set_input_from_db(0,app_grid ); bvpl_batch.set_input_from_db(1,corners_kernel_vector); bvpl_batch.set_input_string(2,"bsta_gauss_f1"); bvpl_batch.set_input_string(3,"negative_gauss_convolution"); bvpl_batch.set_input_string(4, output_dir + "/KL_gaussf1_response.vox"); bvpl_batch.set_input_string(5, output_dir + "/KL_gaussf1_id.vox"); bvpl_batch.run_process(); (all_resp_grid_id,all_resp_grid_type)= bvpl_batch.commit_output(0); all_resp_grid = dbvalue(all_resp_grid_id,all_resp_grid_type); (all_id_grid_id,all_id_grid_type)= bvpl_batch.commit_output(1); all_id_grid = dbvalue(all_id_grid_id, all_id_grid_type); print("Getting top response"); bvpl_batch.init_process("bvplExtractTopResponseProcess"); bvpl_batch.set_input_from_db(0,all_resp_grid ); bvpl_batch.set_input_from_db(1,all_id_grid);
bvpl_batch.run_process() (world_id, world_type) = bvpl_batch.commit_output(0) world = dbvalue(world_id, world_type) print("Creating 3D edge kernel") bvpl_batch.init_process("bvplCreateEdge3dKernelVectorProcess") bvpl_batch.set_input_unsigned(0, 3) bvpl_batch.set_input_unsigned(1, 3) bvpl_batch.set_input_unsigned(2, 3) bvpl_batch.run_process() (kernel_id, kernel_type) = bvpl_batch.commit_output(0) kernel_vector = dbvalue(kernel_id, kernel_type) print("Running Operator") bvpl_batch.init_process("bvplNeighborhoodOperatorProcess") bvpl_batch.set_input_from_db(0, world) bvpl_batch.set_input_from_db(1, kernel) bvpl_batch.set_input_string(2, "float") bvpl_batch.set_input_string(3, "edge_algebraic_mean") bvpl_batch.set_input_string(4, data_dir + "/edge_alge_100.vox") bvpl_batch.run_process() (result_x_world_id, result_x_world_type) = bvpl_batch.commit_output(0) result_x_world = dbvalue(result_x_world_id, result_x_world_type) print("Writing World") bvpl_batch.init_process("bvxmSaveGridRawProcess") bvpl_batch.set_input_from_db(0, result_x_world) bvpl_batch.set_input_string(1, data_dir + "/edge_alge_100.raw") bvpl_batch.set_input_string(2, "float") bvpl_batch.run_process()
# Script to run find 2d corners on appearance grid # Author : Isabel Restrepo #8-31-2009 import bvpl_batch import time #time.sleep(30); bvpl_batch.register_processes(); bvpl_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string find_corners = 1; pair_corners = 1; save_corners_vrml = 1; save_hue = 0; data_dir = "/Users/isa/Experiments/CapitolSFM/few_windows" output_dir = "/Users/isa/Experiments/CapitolSFM/few_windows/ocp+app/main_corners_331" directions = "main_corners" if (find_corners): print("Load Voxel Grid"); bvpl_batch.init_process("bvxmLoadGridProcess"); bvpl_batch.set_input_string(0, data_dir +"/KL_gaussf1.vox"); bvpl_batch.set_input_string(1,"bsta_gauss_f1"); bvpl_batch.run_process(); (world_id,world_type)= bvpl_batch.commit_output(0); app_grid = dbvalue(world_id,world_type);
bvpl_batch.run_process(); (world_id,world_type)= bvpl_batch.commit_output(0); world = dbvalue(world_id,world_type); print("Creating 3D edge kernel"); bvpl_batch.init_process("bvplCreateEdge3dKernelVectorProcess"); bvpl_batch.set_input_unsigned(0, 5); #width bvpl_batch.set_input_unsigned(1, 5); #height bvpl_batch.set_input_unsigned(2, 5); #length bvpl_batch.run_process(); (kernel_id,kernel_type)= bvpl_batch.commit_output(0); kernel_vector = dbvalue(kernel_id,kernel_type); print("Running Operator"); bvpl_batch.init_process("bvplVectorOperatorProcess"); bvpl_batch.set_input_from_db(0,world ); bvpl_batch.set_input_from_db(1,kernel_vector); bvpl_batch.set_input_string(2,"float"); bvpl_batch.set_input_string(3,"edge_algebraic_mean"); bvpl_batch.set_input_string(4, data_dir + "/edge3d_alge.vox"); bvpl_batch.set_input_string(5, data_dir + "/edge3d_alge_orientations.vox"); bvpl_batch.run_process(); (response_grid_id,response_grid_type)= bvpl_batch.commit_output(0); response_grid = dbvalue(response_grid_id,response_grid_type); (orientation_grid_id,orientation_grid_type)= bvpl_batch.commit_output(1); orientation_grid = dbvalue(orientation_grid_id,orientation_grid_type); print("Writing Response Grid"); bvpl_batch.init_process("bvxmSaveGridRawProcess"); bvpl_batch.set_input_from_db(0,response_grid); bvpl_batch.set_input_string(1,data_dir + "/edge3d_alge.raw");
#!/usr/bin/python # Script to run find 2d corners on appearance grid # Author : Isabel Restrepo #8-31-2009 import bvpl_batch import time import sys import os #time.sleep(30); bvpl_batch.register_processes(); bvpl_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string save_hue = 0; #data_dir = "/Users/isa/Experiments/CapitolSFM/few_windows" #output_dir = "/Users/isa/Experiments/CapitolSFM/few_windows/ocp+app/all_directions" data_dir = sys.argv[1]; output_dir = sys.argv[2]; if not os.path.isdir( output_dir + "/"): os.mkdir( output_dir + "/"); print("Load Voxel Grid"); bvpl_batch.init_process("bvxmLoadGridProcess"); bvpl_batch.set_input_string(0, data_dir +"/KL_gaussf1.vox"); bvpl_batch.set_input_string(1,"bsta_gauss_f1"); bvpl_batch.run_process(); (world_id,world_type)= bvpl_batch.commit_output(0); app_grid = dbvalue(world_id,world_type);