Ejemplo n.º 1
0
# 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("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);
	
	
if pair_pairs:

  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);