def run(self):
    while not self.kill_received:
      # get a task
      try:
        job = self.work_queue.get_nowait()
      except Queue.Empty:
        break
      
      start_time = time.time();
      #dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");
      
#      file_in = str(job.pcl_dir) + "/object_" + str(job.object_id) + ".pcd"; 
#      file_out = str(job.pcl_dir) + "/fpfh_object_" + str(job.object_id) + ".pcd";
    
#      file_in = str(job.pcl_dir) + "/boxm_scili.pcd"; 
#      file_out = str(job.pcl_dir) + "/fpfh_boxm_scili.pcd"; 
#      file_in="/Projects/pcl_dev/pcl/trunk/test/bun0.pcd"
      file_in = str(job.pcl_dir) + "/mesh_0.ply"; 
      file_out = str(job.pcl_dir) + "/spin_mesh_0.pcd"; 

      dbrec3d_batch.init_process("pcl_compute_spin_image_process");
      dbrec3d_batch.set_input_string(0, file_in);
      dbrec3d_batch.set_input_double(1, job.radius);
      dbrec3d_batch.set_input_int(2, job.width);
      dbrec3d_batch.set_input_double(3, job.sup_angle);
      dbrec3d_batch.set_input_int(4, job.num_neighbors);
      dbrec3d_batch.set_input_bool(5, job.radial);
      dbrec3d_batch.set_input_bool(6, job.angular);
      dbrec3d_batch.set_input_string(7, file_out);
      dbrec3d_batch.run_process();
      
      dbrec3d_batch.clear();
      #dbrec3d_batch.reset_stdout();
      print ("Runing time for worker:", self.name)
      print(time.time() - start_time);
    def run(self):
        while not self.kill_received:
             # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break
            
            start_time = time.time();
            
            dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");
            dbrec3d_batch.init_process("bofKMeansTrainProcess");
            dbrec3d_batch.set_input_string(0, job.bof_path);
            dbrec3d_batch.set_input_string(1, job.starting_means_path);
            dbrec3d_batch.set_input_int(2, job.scene_id);
            dbrec3d_batch.set_input_int(3, job.block_i);
            dbrec3d_batch.set_input_int(4, job.block_j);
            dbrec3d_batch.set_input_int(5, job.block_k);
            dbrec3d_batch.set_input_unsigned(6, job.max_it);
            dbrec3d_batch.set_input_string(7, job.file_out);
            dbrec3d_batch.run_process();
            
            dbrec3d_batch.clear();
            dbrec3d_batch.reset_stdout();
 
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
    def run(self):
        while not self.kill_received:
             # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break
            
            start_time = time.time();
            
            time.sleep(10);
            
            #dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");
            dbrec3d_batch.init_process("bofMakeClusterIdSceneProcess");
            dbrec3d_batch.set_input_string(0, job.bof_path);
            dbrec3d_batch.set_input_from_db(1, job.codebook);
            dbrec3d_batch.set_input_int(2, job.scene_id);
            dbrec3d_batch.set_input_int(3, job.block_i);
            dbrec3d_batch.set_input_int(4, job.block_j);
            dbrec3d_batch.set_input_int(5, job.block_k);
            dbrec3d_batch.run_process();
            
            dbrec3d_batch.clear();
            #dbrec3d_batch.reset_stdout();
 
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
 def run(self):
     while not self.kill_received:
          # get a task
         try:
             job = self.work_queue.get_nowait()
         except Queue.Empty:
             break
             
         start_time = time.time();    
         
         print("Save Scene");
         dbrec3d_batch.init_process("bofSaveCategorySceneRawProcess");
         dbrec3d_batch.set_input_string(0,job.bof_dir);
         dbrec3d_batch.set_input_int(1, job.scene_id);
         dbrec3d_batch.run_process();
         
         print ("Runing time for worker:", self.name)
         print(time.time() - start_time);
    def run(self):
        while not self.kill_received:
             # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break
            
            start_time = time.time();
            dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");

            dbrec3d_batch.init_process("bofLearnCategoriesProcess");
            dbrec3d_batch.set_input_from_db(0, job.codebook);
            dbrec3d_batch.set_input_int(1, job.scene_id);
            dbrec3d_batch.set_input_string(2, job.bof_dir);
            dbrec3d_batch.set_input_string(3, job.path_out);
            dbrec3d_batch.run_process();
            
            dbrec3d_batch.clear();
            dbrec3d_batch.reset_stdout();
    def run(self):
        while not self.kill_received:
            # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break

            start_time = time.time()
            dbrec3d_batch.set_stdout("logs/log_" + str(os.getpid()) + ".txt")

            dbrec3d_batch.init_process("bof_learn_categories_salient_process")
            dbrec3d_batch.set_input_from_db(0, job.codebook)
            dbrec3d_batch.set_input_int(1, job.scene_id)
            dbrec3d_batch.set_input_float(2, job.top_p)
            dbrec3d_batch.set_input_from_db(3, job.categories)
            dbrec3d_batch.set_input_string(4, job.path_out)
            dbrec3d_batch.run_process()

            dbrec3d_batch.clear()
            dbrec3d_batch.reset_stdout()
    def run(self):
        while not self.kill_received:
             # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break
            
            start_time = time.time();
            dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");

            dbrec3d_batch.init_process("bofClassifyProcess");
            dbrec3d_batch.set_input_from_db(0, job.codebook);
            dbrec3d_batch.set_input_from_db(1, job.p_xc);
            dbrec3d_batch.set_input_int(2, job.scene_id);
            dbrec3d_batch.set_input_string(3, job.bof_dir);
            dbrec3d_batch.set_input_string(4, job.path_out);
            dbrec3d_batch.run_process();
            
            dbrec3d_batch.clear();
            dbrec3d_batch.reset_stdout();
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
Exemple #8
0
min_y = -30;
max_y = 30;
min_z = -15;
max_z = 15;

axes_x=[-1.0,0.0,0.0];
axes_y=[0.0,-1.0,0.0];
axes_z=[0.0,0.0,-1.0];

angle =  0.0;


axis_x = axes_x[0];
axis_y = axes_y[0];
axis_z = axes_z[0];

print("Creating 3D edge kernel");
dbrec3d_batch.init_process("bvplCreateEdge3dKernelProcess");
dbrec3d_batch.set_input_int(0,min_x);
dbrec3d_batch.set_input_int(1,max_x);
dbrec3d_batch.set_input_int(2,min_y);
dbrec3d_batch.set_input_int(3,max_y);
dbrec3d_batch.set_input_int(4,min_z);
dbrec3d_batch.set_input_int(5,max_z);
dbrec3d_batch.set_input_float(6,axis_x);
dbrec3d_batch.set_input_float(7,axis_y);
dbrec3d_batch.set_input_float(8,axis_z);
dbrec3d_batch.set_input_float(9,angle);
dbrec3d_batch.run_process();
(kernel_id,kernel_type)= dbrec3d_batch.commit_output(0);
kernel = dbvalue(kernel_id,kernel_type);
  #Parse inputs
  parser = optparse.OptionParser(description='bof Statistics Pass 0');

  parser.add_option('--bof_dir', action="store", dest="bof_dir");
  parser.add_option('--init_k_means_dir', action="store", dest="init_k_means_dir");
  parser.add_option('--num_means', action="store", dest="num_means", type="int", default =50)
  
  options, args = parser.parse_args()

  bof_dir = options.bof_dir;
  num_means = options.num_means;
  init_k_means_dir = options.init_k_means_dir;

  if not os.path.isdir(bof_dir +"/"):
    print "Invalid bof Dir"
    sys.exit(-1);
    
  if not os.path.isdir(init_k_means_dir +"/"):
    os.mkdir(init_k_means_dir +"/");
    
    
  dbrec3d_batch.init_process("bofRndMeansProcess");
  dbrec3d_batch.set_input_string(0,bof_dir);
  dbrec3d_batch.set_input_int(1,num_means);
  dbrec3d_batch.set_input_string(2, init_k_means_dir + "/sp_means.txt");
  dbrec3d_batch.run_process();
  
  dbrec3d_batch.clear();

dbrec3d_batch.run_process();

dbrec3d_batch.print_db();

#Parameters to group edge "0" and "1"
mean_x = 2.0; mean_y = 0; mean_z = 2.0;
var = 3;
xmin=-5; ymin=-1; zmin=-7;
xmax=0; ymax=1; zmax=0;

print("Composing pairs");
id_0 = 0; id_1=1;
print(str(id_0));
print(str(id_1));
dbrec3d_batch.init_process("dbrec3dFindPairsProcess");
dbrec3d_batch.set_input_int(0, id_0);
dbrec3d_batch.set_input_int(1, id_1);
dbrec3d_batch.set_input_double(2,mean_x); 
dbrec3d_batch.set_input_double(3,mean_y);
dbrec3d_batch.set_input_double(4,mean_z);
dbrec3d_batch.set_input_double(5,var);
dbrec3d_batch.set_input_double(6,var);
dbrec3d_batch.set_input_double(7,var);
dbrec3d_batch.set_input_int(8,xmin);
dbrec3d_batch.set_input_int(9,ymin);
dbrec3d_batch.set_input_int(10,zmin);
dbrec3d_batch.set_input_int(11,xmax);
dbrec3d_batch.set_input_int(12,ymax);
dbrec3d_batch.set_input_int(13,zmax);
dbrec3d_batch.set_input_string(14, pair_scene_dir);
dbrec3d_batch.run_process();
pair_scene_dir = "/Users/isa/Experiments/tests/edges_pairs/0_1_pair";
if not os.path.isdir( pair_scene_dir + "/"):
  os.mkdir( pair_scene_dir + "/");
#Compose pairs

print("Loading Parts and Contexts");
dbrec3d_batch.init_process("dbrec3dXmlParseProcess");
dbrec3d_batch.set_input_string(0, pair_scene_dir + "/hierarchy.xml");
dbrec3d_batch.set_input_string(1, pair_scene_dir + "/contexts.xml");
dbrec3d_batch.run_process();

dbrec3d_batch.print_db();

print("Save VRML");
dbrec3d_batch.init_process("dbrec3dSaveVrmlProcess");
dbrec3d_batch.set_input_int(0,4);
dbrec3d_batch.set_input_string(1,pair_scene_dir + "/edges_01.wrl");
dbrec3d_batch.set_input_double(2, 0.13);
dbrec3d_batch.set_input_double(3, -0.08);
dbrec3d_batch.set_input_double(4, 0);
dbrec3d_batch.set_input_double(5, -0.08);
dbrec3d_batch.set_input_double(6, -0.03);
dbrec3d_batch.set_input_double(7, 0.05);
dbrec3d_batch.run_process();

 
print("Save Parts and Contexts");
dbrec3d_batch.init_process("dbrec3dXmlWriteProcess");
dbrec3d_batch.set_input_string(0, pair_scene_dir + "/hierarchy2.xml");
dbrec3d_batch.set_input_string(1, pair_scene_dir + "/contexts2.xml");
dbrec3d_batch.run_process();