print("Creating a Scene");
boxm_batch.init_process("boxmCreateSceneProcess");
boxm_batch.set_input_string(0,  model_dir +"/scene.xml");
boxm_batch.run_process();
(scene_id, scene_type) = boxm_batch.commit_output(0);
scene = dbvalue(scene_id, scene_type);

#print("Save Scene");
#boxm_batch.init_process("boxmSaveOccupancyRawProcess");
#boxm_batch.set_input_from_db(0,scene);
#boxm_batch.set_input_string(1,model_dir + "/scene");
#boxm_batch.set_input_unsigned(2,0);
#boxm_batch.set_input_unsigned(3,1);
#boxm_batch.run_process();

print("Crop Scene");
boxm_batch.init_process("boxmCropSceneProcess");
boxm_batch.set_params_process(model_dir + "/crop_scene_params.xml");
boxm_batch.set_input_from_db(0,scene);
boxm_batch.run_process();
(scene_id, scene_type) = boxm_batch.commit_output(0);
cropped_scene = dbvalue(scene_id, scene_type);

#print("Save Scene");
#boxm_batch.init_process("boxmSaveOccupancyRawProcess");
#boxm_batch.set_input_from_db(0,cropped_scene);
#boxm_batch.set_input_string(1,model_dir + "/croped_scene");
#boxm_batch.set_input_unsigned(2,0);
#boxm_batch.set_input_unsigned(3,1);
#boxm_batch.run_process();
import boxm_batch;
boxm_batch.register_processes();
boxm_batch.register_datatypes();

class dbvalue:
  def __init__(self, index, type):
    self.id = index    # unsigned integer
    self.type = type   # string

print("Creating a Scene");
boxm_batch.init_process("boxmCreateSceneProcess");
boxm_batch.set_params_process("createScene.xml");
boxm_batch.run_process();
(scene_id, scene_type) = boxm_batch.commit_output(0);
scene = dbvalue(scene_id, scene_type);

camera_fnames = "C:/test_images/octree/CapitolSiteHigh/cameras_KRT/camera_%05d.txt";
image_fnames = "C:/test_images/octree/CapitolSiteHigh/video/frame_%05d.png";

import random

min_range = 10;
last_i = -min_range;
nframes = 145;

for x in range(125,nframes,1):
  print("*************************************************************************************");
  print x;
  i = random.randint(0,254);
  # try, try again if this frame is too close to the last
  while (abs(i - last_i) < min_range):