Exemplo n.º 1
0
def img_registration_by_rmse(src_img, tgr_img, sx, sy, sz = 0.0, pixel_res=1.0, invalid_pixel=-9999.0, mask_img=None):
  bvxm_batch.init_process("vilImageRegistrationProcess")
  bvxm_batch.set_input_from_db(0, src_img)
  bvxm_batch.set_input_from_db(1, tgr_img)
  bvxm_batch.set_input_unsigned(2,sx)
  bvxm_batch.set_input_unsigned(3,sy)
  bvxm_batch.set_input_double(4, sz)
  bvxm_batch.set_input_double(5, pixel_res)
  bvxm_batch.set_input_float(6,invalid_pixel)
  if mask_img:
    bvxm_batch.set_input_from_db(7,mask_img)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    trans_x = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(1)
    trans_y = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(2)
    trans_z = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(3)
    rmse_z = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(4)
    var_z  = bvxm_batch.get_output_double(id)
    return trans_x, trans_y, trans_z, rmse_z, var_z
  else:
    return -1.0, -1.0, -1.0, -1.0, -1.0
Exemplo n.º 2
0
def save_occupancy_raw(world, filename, app_model, scale=0):
    batch.init_process("bvxmSaveOccupancyRawProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, filename)
    batch.set_input_unsigned(2, scale)
    batch.set_input_string(3, app_model)
    batch.run_process()
Exemplo n.º 3
0
def get_plane(img, plane_id):
  bvxm_batch.init_process("vilGetPlaneProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_unsigned(1, plane_id);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img_plane = dbvalue(id, type);
  return img_plane;
Exemplo n.º 4
0
def img_sum(img, plane_index=0):
  bvxm_batch.init_process("vilImageSumProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_unsigned(1,plane_index)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  value = bvxm_batch.get_output_double(id)
  return value
Exemplo n.º 5
0
def image_entropy(img, block_size = 5):
  bvxm_batch.init_process("vilBlockEntropyProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_unsigned(1, block_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  entropy_img = dbvalue(id, type);
  return entropy_img;
Exemplo n.º 6
0
def image_entropy(img, block_size=5, bins=16):
    bvxm_batch.init_process("vilBlockEntropyProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_unsigned(1, block_size)
    bvxm_batch.set_input_unsigned(2, bins)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    entropy_img = dbvalue(id, type)
    return entropy_img
Exemplo n.º 7
0
def mask_image_using_id(img, id_img, input_id):
  bvxm_batch.init_process("vilMaskImageUsingIDsProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_from_db(1, id_img);
  bvxm_batch.set_input_unsigned(2, input_id);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  masked_img = dbvalue(id, type);
  return masked_img;
Exemplo n.º 8
0
def arf_seek_frame(rawStream, frame):
    bvxm_batch.init_process("bilArfSeekFrameProcess")
    bvxm_batch.set_input_from_db(0, rawStream)
    bvxm_batch.set_input_unsigned(1, frame)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    time = bvxm_batch.get_output_unsigned(id)
    return img, time
Exemplo n.º 9
0
def compute_mean_and_variance_image(img, n):
    bvxm_batch.init_process("vilMeanAndVarianceImageProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_unsigned(1, n)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img_mean = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    img_var = dbvalue(id, type)
    return img_mean, img_var
Exemplo n.º 10
0
def threshold_image(img, value, threshold_above=True, id=255):
    bvxm_batch.init_process("vilThresholdImageProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, value)
    bvxm_batch.set_input_bool(2, threshold_above)
    bvxm_batch.set_input_unsigned(3, id)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
Exemplo n.º 11
0
def arf_seek_frame(rawStream, frame):
    bvxm_batch.init_process("bilArfSeekFrameProcess")
    bvxm_batch.set_input_from_db(0, rawStream)
    bvxm_batch.set_input_unsigned(1, frame)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    time = bvxm_batch.get_output_unsigned(id)
    return img, time
Exemplo n.º 12
0
def get_number_of_planes(img):
  bvxm_batch.init_process("vilGetPlaneProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_unsigned(1, plane_id);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img_plane = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  n_planes = bvxm_batch.get_output_unsigned(id)
  return img_plane, n_planes;
Exemplo n.º 13
0
def seek_frame(rawStream, frame) :
  bvxm_batch.init_process("bilSeekFrameProcess")
  bvxm_batch.set_input_from_db(0,rawStream);
  bvxm_batch.set_input_unsigned(1,frame);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img = dbvalue(id,type);
  #(id, type) = bvxm_batch.commit_output(1);
  #time = bvxm_batch.get_output_unsigned(id);
  return img
Exemplo n.º 14
0
def compute_mean_and_variance_image(img,n):
  bvxm_batch.init_process("vilMeanAndVarianceImageProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_unsigned(1,n)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  img_mean = dbvalue(id,type)
  (id,type) = bvxm_batch.commit_output(1)
  img_var = dbvalue(id,type)
  return img_mean, img_var
Exemplo n.º 15
0
def render_uncertainty_img(input_cam, ni, nj, world):
    batch.init_process("bvxmUncertaintyProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, input_cam)
    batch.set_input_unsigned(2, ni)
    batch.set_input_unsigned(3, nj)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemplo n.º 16
0
def threshold_image(img, value, threshold_above=True, id=255):
    bvxm_batch.init_process("vilThresholdImageProcess")
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.set_input_float(1,value)
    bvxm_batch.set_input_bool(2,threshold_above)
    bvxm_batch.set_input_unsigned(3, id)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id,type)
    return mask
Exemplo n.º 17
0
def render_height_map_with_cam(world, input_cam, ni, nj, is_negate=False):
    batch.init_process("bvxmHeightmapProcess")
    batch.set_input_from_db(0, input_cam)
    batch.set_input_unsigned(1, ni)
    batch.set_input_unsigned(2, nj)
    batch.set_input_from_db(3, world)
    batch.set_input_bool(4, is_negate)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_d_img = dbvalue(id, type)
    return out_d_img
Exemplo n.º 18
0
def render_height_map_with_cam(world, input_cam, ni, nj, is_negate=False):
    batch.init_process("bvxmHeightmapProcess")
    batch.set_input_from_db(0, input_cam)
    batch.set_input_unsigned(1, ni)
    batch.set_input_unsigned(2, nj)
    batch.set_input_from_db(3, world)
    batch.set_input_bool(4, is_negate)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_d_img = dbvalue(id, type)
    return out_d_img
Exemplo n.º 19
0
def update_edges(world, cropped_cam, cropped_edge_image, edge_prob_mask_size=21, edge_prob_mask_sigma=1.0, scale=0):
    batch.init_process("bvxmUpdateEdgesProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cropped_cam)
    batch.set_input_from_db(2, cropped_edge_image)
    batch.set_input_unsigned(3, 0)
    batch.set_input_int(4, edge_prob_mask_size)
    batch.set_input_float(5, edge_prob_mask_sigma)
# batch.set_params_process(update_params_xml); #
# "./bvxmUpdateEdgesProcess.xml");
    batch.run_process()
Exemplo n.º 20
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    batch.init_process("bvxmHeightmapExpectedProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, input_cam)
    batch.set_input_unsigned(2, ni)
    batch.set_input_unsigned(3, nj)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
Exemplo n.º 21
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    batch.init_process("bvxmHeightmapExpectedProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, input_cam)
    batch.set_input_unsigned(2, ni)
    batch.set_input_unsigned(3, nj)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
Exemplo n.º 22
0
def create_scene_xml(scene_xml,
                     world_dir,
                     lvcs,
                     lvcs_file,
                     dim_x,
                     dim_y,
                     dim_z,
                     voxel_size=1.0,
                     corner_x=0.0,
                     corner_y=0.0,
                     corner_z=0.0,
                     min_ocp_prob=0.001,
                     max_ocp_prob=0.999,
                     max_scale=1):
    batch.init_process("bvxmCreateSceneXmlProcess")
    batch.set_input_string(0, scene_xml)
    batch.set_input_string(1, world_dir)
    batch.set_input_float(2, corner_x)
    batch.set_input_float(3, corner_y)
    batch.set_input_float(4, corner_z)
    batch.set_input_unsigned(5, dim_x)
    batch.set_input_unsigned(6, dim_y)
    batch.set_input_unsigned(7, dim_z)
    batch.set_input_float(8, voxel_size)
    batch.set_input_from_db(9, lvcs)
    batch.set_input_string(10, lvcs_file)
    batch.set_input_float(11, min_ocp_prob)
    batch.set_input_float(12, max_ocp_prob)
    batch.set_input_unsigned(13, max_scale)
    return batch.run_process()
Exemplo n.º 23
0
def render_ortho_edgemap(world, scale=0):
    print("Rendering ortho edge map")
    batch.init_process("bvxmEdgemapOrthoProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_unsigned(1, 0)  # scale
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_e_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_e_img_byte = dbvalue(id, type)
    (id, type) = batch.commit_output(2)
    out_h_img = dbvalue(id, type)
    (id, type) = batch.commit_output(3)
    ortho_cam = dbvalue(id, type)
    return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Exemplo n.º 24
0
def render_ortho_edgemap(world, scale=0):
    print("Rendering ortho edge map")
    batch.init_process("bvxmEdgemapOrthoProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_unsigned(1, 0)  # scale
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_e_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_e_img_byte = dbvalue(id, type)
    (id, type) = batch.commit_output(2)
    out_h_img = dbvalue(id, type)
    (id, type) = batch.commit_output(3)
    ortho_cam = dbvalue(id, type)
    return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Exemplo n.º 25
0
def update_edges(world,
                 cropped_cam,
                 cropped_edge_image,
                 edge_prob_mask_size=21,
                 edge_prob_mask_sigma=1.0,
                 scale=0):
    batch.init_process("bvxmUpdateEdgesProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cropped_cam)
    batch.set_input_from_db(2, cropped_edge_image)
    batch.set_input_unsigned(3, 0)
    batch.set_input_int(4, edge_prob_mask_size)
    batch.set_input_float(5, edge_prob_mask_sigma)
    # batch.set_params_process(update_params_xml); #
    # "./bvxmUpdateEdgesProcess.xml");
    batch.run_process()
Exemplo n.º 26
0
def init_byte_img(ni, nj, np=1, val=0):
    bvxm_batch.init_process("vilInitByteImageProcess")
    bvxm_batch.set_input_unsigned(0, ni)
    bvxm_batch.set_input_unsigned(1, nj)
    bvxm_batch.set_input_unsigned(2, np)
    bvxm_batch.set_input_unsigned(3, val)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 27
0
def init_byte_img(ni,nj,np = 1,val = 0):
  bvxm_batch.init_process("vilInitByteImageProcess")
  bvxm_batch.set_input_unsigned(0,ni);
  bvxm_batch.set_input_unsigned(1,nj);
  bvxm_batch.set_input_unsigned(2,np);
  bvxm_batch.set_input_unsigned(3,val);
  bvxm_batch.run_process()
  (id, type) = bvxm_batch.commit_output(0)
  img_out = dbvalue(id,type)
  return img_out
Exemplo n.º 28
0
def write_scene_kml(scene, kml_filename, is_overwrite=True, r=255, g=255, b=255, a=0, name=""):
    batch.init_process("bvxmSceneKmlProcess")
    batch.set_input_from_db(0, scene)
    batch.set_input_string(1, kml_filename)
    batch.set_input_bool(2, is_overwrite)
    batch.set_input_unsigned(3, r)
    batch.set_input_unsigned(4, g)
    batch.set_input_unsigned(5, b)
    batch.set_input_unsigned(6, a)
    batch.set_input_string(7, name)
    batch.run_process()
Exemplo n.º 29
0
def crop_image_res(img_res,i0,j0,ni,nj):
  bvxm_batch.init_process("vilCropImageResProcess")
  bvxm_batch.set_input_from_db(0, img_res)
  bvxm_batch.set_input_unsigned(1, i0);
  bvxm_batch.set_input_unsigned(2, j0);
  bvxm_batch.set_input_unsigned(3, ni);
  bvxm_batch.set_input_unsigned(4, nj);
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  img_out = dbvalue(id,type)
  return img_out
Exemplo n.º 30
0
def crop_image_res(img_res, i0, j0, ni, nj):
    bvxm_batch.init_process("vilCropImageResProcess")
    bvxm_batch.set_input_from_db(0, img_res)
    bvxm_batch.set_input_unsigned(1, i0)
    bvxm_batch.set_input_unsigned(2, j0)
    bvxm_batch.set_input_unsigned(3, ni)
    bvxm_batch.set_input_unsigned(4, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 31
0
def render_exp_image(cam, ni, nj, world, app_model, bin_index=0, scale_index=0):
    batch.init_process("bvxmRenderExpectedImageProcess")
    batch.set_input_from_db(0, cam)
    batch.set_input_unsigned(1, ni)
    batch.set_input_unsigned(2, nj)
    batch.set_input_from_db(3, world)
    batch.set_input_string(4, app_model)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(5, bin_index)
    batch.set_input_unsigned(6, scale_index)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_conf_img = dbvalue(id, type)
    return out_img, out_conf_img
Exemplo n.º 32
0
def rpc_registration(world, cropped_cam, cropped_edge_image, uncertainty, shift_3d_flag=0, scale=0, is_uncertainty_float=0):
    batch.init_process("bvxmRpcRegistrationProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cropped_cam)
    batch.set_input_from_db(2, cropped_edge_image)
    batch.set_input_bool(3, shift_3d_flag)
    if is_uncertainty_float == 1:
        print "uncertainty = ", uncertainty
        batch.set_input_float(4, uncertainty)
    else:
        batch.set_input_from_db(4, uncertainty)
    batch.set_input_unsigned(5, scale)
    batch.run_process()
    (cam_id, cam_type) = batch.commit_output(0)
    cam = dbvalue(cam_id, cam_type)
    (expected_edge_image_id, expected_edge_image_type) = batch.commit_output(1)
    expected_edge_image = dbvalue(
        expected_edge_image_id, expected_edge_image_type)
    (offset_u_id, offset_u_type) = batch.commit_output(2)
    offset_u = batch.get_output_double(offset_u_id)
    (offset_v_id, offset_v_type) = batch.commit_output(3)
    offset_v = batch.get_output_double(offset_v_id)
    return cam, expected_edge_image, offset_u, offset_v
Exemplo n.º 33
0
def init_float_img(ni,nj,np,val):
  bvxm_batch.init_process("vilInitFloatImageProcess")
  bvxm_batch.set_input_unsigned(0,ni)
  bvxm_batch.set_input_unsigned(1,nj)
  bvxm_batch.set_input_unsigned(2,np)
  bvxm_batch.set_input_float(3,val)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  img_out = dbvalue(id,type)
  return img_out
Exemplo n.º 34
0
def write_scene_kml(scene,
                    kml_filename,
                    is_overwrite=True,
                    r=255,
                    g=255,
                    b=255,
                    a=0,
                    name=""):
    batch.init_process("bvxmSceneKmlProcess")
    batch.set_input_from_db(0, scene)
    batch.set_input_string(1, kml_filename)
    batch.set_input_bool(2, is_overwrite)
    batch.set_input_unsigned(3, r)
    batch.set_input_unsigned(4, g)
    batch.set_input_unsigned(5, b)
    batch.set_input_unsigned(6, a)
    batch.set_input_string(7, name)
    batch.run_process()
Exemplo n.º 35
0
def create_scene_xml(scene_xml, world_dir, lvcs, lvcs_file, dim_x, dim_y, dim_z, voxel_size=1.0, corner_x=0.0, corner_y=0.0, corner_z=0.0,
                     min_ocp_prob=0.001, max_ocp_prob=0.999, max_scale=1):
    batch.init_process("bvxmCreateSceneXmlProcess")
    batch.set_input_string(0, scene_xml)
    batch.set_input_string(1, world_dir)
    batch.set_input_float(2,  corner_x)
    batch.set_input_float(3,  corner_y)
    batch.set_input_float(4,  corner_z)
    batch.set_input_unsigned(5, dim_x)
    batch.set_input_unsigned(6, dim_y)
    batch.set_input_unsigned(7, dim_z)
    batch.set_input_float(8, voxel_size)
    batch.set_input_from_db(9, lvcs)
    batch.set_input_string(10, lvcs_file)
    batch.set_input_float(11, min_ocp_prob)
    batch.set_input_float(12, max_ocp_prob)
    batch.set_input_unsigned(13, max_scale)
    return batch.run_process()
Exemplo n.º 36
0
def render_exp_edge_img(cam, ni, nj, world, scale=0):
    batch.init_process("bvxmExpectedEdgeImageProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cam)
    batch.set_input_unsigned(2, ni)
    batch.set_input_unsigned(3, nj)
    batch.set_input_unsigned(4, scale)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    exp_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    exp_img_byte = dbvalue(id, type)
    return exp_img, exp_img_byte
Exemplo n.º 37
0
def render_exp_edge_img(cam, ni, nj, world, scale=0):
    batch.init_process("bvxmExpectedEdgeImageProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cam)
    batch.set_input_unsigned(2, ni)
    batch.set_input_unsigned(3, nj)
    batch.set_input_unsigned(4, scale)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    exp_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    exp_img_byte = dbvalue(id, type)
    return exp_img, exp_img_byte
Exemplo n.º 38
0
def render_exp_image(cam,
                     ni,
                     nj,
                     world,
                     app_model,
                     bin_index=0,
                     scale_index=0):
    batch.init_process("bvxmRenderExpectedImageProcess")
    batch.set_input_from_db(0, cam)
    batch.set_input_unsigned(1, ni)
    batch.set_input_unsigned(2, nj)
    batch.set_input_from_db(3, world)
    batch.set_input_string(4, app_model)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(5, bin_index)
    batch.set_input_unsigned(6, scale_index)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_conf_img = dbvalue(id, type)
    return out_img, out_conf_img
Exemplo n.º 39
0
def update_appearance(img, cam, world, app_type, bin_index=0, scale_index=0, use_cache=0):
    batch.init_process("bvxmUpdateProcess")
    batch.set_input_from_db(0, img)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_string(3, app_type)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(4, bin_index)
    batch.set_input_unsigned(5, scale_index)
    batch.set_input_unsigned(6, use_cache)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    density_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    density_mask_img = dbvalue(id, type)
    return density_img, density_mask_img
Exemplo n.º 40
0
def update_appearance(img,
                      cam,
                      world,
                      app_type,
                      bin_index=0,
                      scale_index=0,
                      use_cache=0):
    batch.init_process("bvxmUpdateProcess")
    batch.set_input_from_db(0, img)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_string(3, app_type)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(4, bin_index)
    batch.set_input_unsigned(5, scale_index)
    batch.set_input_unsigned(6, use_cache)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    density_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    density_mask_img = dbvalue(id, type)
    return density_img, density_mask_img
Exemplo n.º 41
0
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.set_input_from_db(2, voxel_world_id)
bvxm_batch.run_process()
cam_id = bvxm_batch.commit_output(0)
lidar_id = bvxm_batch.commit_output(1)

print("Updating World")
bvxm_batch.init_process("bvxmUpdateLidarProcess")
bvxm_batch.set_input_from_db(0, lidar_id)
bvxm_batch.set_input_from_db(1, cam_id)
bvxm_batch.set_input_from_db(2, voxel_world_id)
bvxm_batch.set_input_unsigned(3, 0)
bvxm_batch.run_process()

out_img_id = bvxm_batch.commit_output(0)
mask_img_id = bvxm_batch.commit_output(1)
###################################################

print voxel_world_id
#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()
Exemplo n.º 42
0
    print statuscode
    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)

        print("Compass edge detector  Image")
        batch.init_process("bilCompassEdgeDetectorProcess")
        batch.set_input_from_db(0, cropped_image)
        batch.set_input_unsigned(1, 8)
        batch.set_input_double(2, 2.0)
        batch.set_input_double(3, 0.4)
        batch.run_process()
        (cropped_edge_image_id,
         cropped_edge_image_type) = batch.commit_output(0)
        cropped_edge_image = dbvalue(cropped_edge_image_id,
                                     cropped_edge_image_type)

        batch.init_process("bvxmRpcRegistrationProcess")
        batch.set_input_from_db(0, world)
        batch.set_input_from_db(1, cropped_cam)
        batch.set_input_from_db(2, cropped_edge_image)
        batch.set_input_bool(3, 0)
        batch.set_input_float(4, 25)
        batch.set_input_float(5, 0)
Exemplo n.º 43
0
    batch.set_params_process("./roi_params.xml")
    statuscode = batch.run_process()
    print statuscode
    if statuscode:
        cropped_cam_id = batch.commit_output(0)
        cropped_image_id = batch.commit_output(1)
        uncertainty_id = batch.commit_output(2)

        curr_scale = 0

        map_type = "10bins_1d_radial"
        print("Illumination Index")
        batch.init_process("bvxmIllumIndexProcess")
        batch.set_input_string(0, map_type)
        batch.set_input_string(1, image_filename)
        batch.set_input_unsigned(2, 8)
        batch.set_input_unsigned(3, 0)
        batch.run_process()
        bin_id = batch.commit_output(0)

        app_type = "apm_mog_grey"

        if normalize_and_save == 1:
            # Normalizing images
            print(" Normalizing Image ")
            batch.init_process("bvxmNormalizeImageProcess")
            batch.set_params_process("./normalize.xml")
            batch.set_input_from_db(0, cropped_image_id)
            batch.set_input_from_db(1, cropped_cam_id)
            batch.set_input_from_db(2, voxel_world_id)
            batch.set_input_string(3, app_type)
  bvxm_batch.set_params_process("./roi_params.xml");
  statuscode=bvxm_batch.run_process();
  print statuscode;
  if statuscode:
    cropped_cam_id = bvxm_batch.commit_output(0);
    cropped_image_id = bvxm_batch.commit_output(1); 
    uncertainty_id = bvxm_batch.commit_output(2);

    curr_scale = 0;
    
    map_type="10bins_1d_radial";
    print("Illumination Index");
    bvxm_batch.init_process("bvxmIllumIndexProcess");
    bvxm_batch.set_input_string(0,map_type);
    bvxm_batch.set_input_string(1,image_filename);
    bvxm_batch.set_input_unsigned(2,8);
    bvxm_batch.set_input_unsigned(3,0);
    bvxm_batch.run_process();
    bin_id = bvxm_batch.commit_output(0);
    
    app_type="apm_mog_grey";
    
    if normalize_and_save==1:
      # Normalizing images
      print(" Normalizing Image ");
      bvxm_batch.init_process("bvxmNormalizeImageProcess");
      bvxm_batch.set_params_process("./normalize.xml");
      bvxm_batch.set_input_from_db(0,cropped_image_id);
      bvxm_batch.set_input_from_db(1,cropped_cam_id);
      bvxm_batch.set_input_from_db(2,voxel_world_id);
      bvxm_batch.set_input_string(3,app_type);
Exemplo n.º 45
0
  print statuscode;
  if statuscode:
    (cropped_cam_id, cropped_cam_type) = bvxm_batch.commit_output(0);
    cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type);

    (cropped_image_id, cropped_image_type) = bvxm_batch.commit_output(1);
    cropped_image=dbvalue(cropped_image_id, cropped_image_type);

    (uncertainty_id,uncertainty_type) = bvxm_batch.commit_output(2);
    uncertainty = dbvalue(uncertainty_id,uncertainty_type);

    print("Compass edge detector  Image");
    bvxm_batch.init_process("bilCompassEdgeDetectorProcess");
    bvxm_batch.set_input_from_db(0,cropped_image);
    bvxm_batch.set_input_unsigned(1,8);
    bvxm_batch.set_input_double(2,2.0);
    bvxm_batch.set_input_double(3,0.4);
    bvxm_batch.run_process();
    (cropped_edge_image_id,cropped_edge_image_type) = bvxm_batch.commit_output(0);
    cropped_edge_image = dbvalue(cropped_edge_image_id,cropped_edge_image_type);

    bvxm_batch.init_process("bvxmRpcRegistrationProcess");
    bvxm_batch.set_input_from_db(0,world);
    bvxm_batch.set_input_from_db(1,cropped_cam);
    bvxm_batch.set_input_from_db(2,cropped_edge_image);
    bvxm_batch.set_input_bool(3,0);
    bvxm_batch.set_input_float(4,25);
    bvxm_batch.set_input_float(5,0);
    bvxm_batch.set_input_unsigned(6,0);
    bvxm_batch.run_process();
Exemplo n.º 46
0
bvxm_batch.set_params_process("lidar_params.xml");
bvxm_batch.set_input_string(0,"C:/test_images/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif");
bvxm_batch.set_input_string(1,"C:/test_images/BaghdadLIDAR/dem_1m_a2_baghdad_tile39.tif");
bvxm_batch.set_input_from_db(2,world);
bvxm_batch.run_process();
(cam_id,cam_type)=bvxm_batch.commit_output(0);
cam=dbvalue(cam_id,cam_type);
(lidar_id, lidar_type)=bvxm_batch.commit_output(1);
lidar=dbvalue(lidar_id, lidar_type);

print("Updating World");
bvxm_batch.init_process("bvxmUpdateLidarProcess");
bvxm_batch.set_input_from_db(0,lidar);
bvxm_batch.set_input_from_db(1,cam);
bvxm_batch.set_input_from_db(2,world);
bvxm_batch.set_input_unsigned(3,0);
bvxm_batch.run_process();
##########################

f=open('./images.txt', 'r')
image_fnames=f.readlines();
f.close();
f=open('./cameras.txt', 'r')
cam_fnames=f.readlines();
f.close();

n_normal = 0;

for i in range(0,len(image_fnames),1):
  image_fnames[i] = image_fnames[i].strip();
  cam_fnames[i] = cam_fnames[i].strip();
Exemplo n.º 47
0
        print("Saving Image")
        bvxm_batch.init_process("SaveImageViewProcess")
        bvxm_batch.set_input_from_db(0, cropped_image_id)
        bvxm_batch.set_input_string(1, "./ini" + str(i) + ".png")
        bvxm_batch.run_process()

        bvxm_batch.init_process("bvxmRpcRegistrationProcess")
        bvxm_batch.set_input_from_db(0, voxel_world_id)
        bvxm_batch.set_input_from_db(1, cropped_cam_id)
        bvxm_batch.set_input_from_db(2, cropped_image_id)
        if i < num_train:
            bvxm_batch.set_input_bool(3, 0)
        else:
            bvxm_batch.set_input_bool(3, 1)
        bvxm_batch.set_input_from_db(4, uncertainty_id)
        bvxm_batch.set_input_unsigned(5, 0)
        bvxm_batch.set_params_process("bvxmRpcRegistrationProcess.xml")
        bvxm_batch.run_process()
        corrected_cam_id = bvxm_batch.commit_output(0)
        edge_image_id = bvxm_batch.commit_output(1)
        expected_edge_image_id = bvxm_batch.commit_output(2)

        bvxm_batch.init_process("SaveImageViewProcess")
        bvxm_batch.set_input_from_db(0, edge_image_id)
        bvxm_batch.set_input_string(1, str(i) + ".edge_image.jpg")
        bvxm_batch.run_process()

        bvxm_batch.init_process("SaveImageViewProcess")
        bvxm_batch.set_input_from_db(0, expected_edge_image_id)
        bvxm_batch.set_input_string(1, str(i) + ".expected_edge_image.jpg")
        bvxm_batch.run_process()
    bvxm_batch.set_params_process("./roi_params.xml")
    statuscode = bvxm_batch.run_process()
    print statuscode
    if statuscode:
        cropped_cam_id = bvxm_batch.commit_output(0)
        cropped_image_id = bvxm_batch.commit_output(1)
        uncertainty_id = bvxm_batch.commit_output(2)

        curr_scale = 0

        map_type = "10bins_1d_radial"
        print("Illumination Index")
        bvxm_batch.init_process("bvxmIllumIndexProcess")
        bvxm_batch.set_input_string(0, map_type)
        bvxm_batch.set_input_string(1, image_filename)
        bvxm_batch.set_input_unsigned(2, 8)
        bvxm_batch.set_input_unsigned(3, 0)
        bvxm_batch.run_process()
        bin_id = bvxm_batch.commit_output(0)

        app_type = "apm_mog_grey"

        if normalize_and_save == 1:
            # Normalizing images
            print(" Normalizing Image ")
            bvxm_batch.init_process("bvxmNormalizeImageProcess")
            bvxm_batch.set_params_process("./normalize.xml")
            bvxm_batch.set_input_from_db(0, cropped_image_id)
            bvxm_batch.set_input_from_db(1, cropped_cam_id)
            bvxm_batch.set_input_from_db(2, voxel_world_id)
            bvxm_batch.set_input_string(3, app_type)
Exemplo n.º 49
0
    print statuscode
    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)

        print("Compass edge detector  Image")
        batch.init_process("bilCompassEdgeDetectorProcess")
        batch.set_input_from_db(0, cropped_image)
        batch.set_input_unsigned(1, 8)
        batch.set_input_double(2, 2.0)
        batch.set_input_double(3, 0.4)
        batch.run_process()
        (cropped_edge_image_id, cropped_edge_image_type) = batch.commit_output(0)
        cropped_edge_image = dbvalue(
            cropped_edge_image_id, cropped_edge_image_type)

        batch.init_process("bvxmRpcRegistrationProcess")
        batch.set_input_from_db(0, world)
        batch.set_input_from_db(1, cropped_cam)
        batch.set_input_from_db(2, cropped_edge_image)
        batch.set_input_bool(3, 0)
        batch.set_input_float(4, 25)
        batch.set_input_float(5, 0)
        batch.set_input_unsigned(6, 0)
Exemplo n.º 50
0
        print("Saving Image")
        batch.init_process("SaveImageViewProcess")
        batch.set_input_from_db(0, cropped_image_id)
        batch.set_input_string(1, "./ini" + str(i) + ".png")
        batch.run_process()

        batch.init_process("bvxmRpcRegistrationProcess")
        batch.set_input_from_db(0, voxel_world_id)
        batch.set_input_from_db(1, cropped_cam_id)
        batch.set_input_from_db(2, cropped_image_id)
        if i < num_train:
            batch.set_input_bool(3, 0)
        else:
            batch.set_input_bool(3, 1)
        batch.set_input_from_db(4, uncertainty_id)
        batch.set_input_unsigned(5, 0)
        batch.set_params_process("bvxmRpcRegistrationProcess.xml")
        batch.run_process()
        corrected_cam_id = batch.commit_output(0)
        edge_image_id = batch.commit_output(1)
        expected_edge_image_id = batch.commit_output(2)

        batch.init_process("SaveImageViewProcess")
        batch.set_input_from_db(0, edge_image_id)
        batch.set_input_string(1, str(i) + ".edge_image.jpg")
        batch.run_process()

        batch.init_process("SaveImageViewProcess")
        batch.set_input_from_db(0, expected_edge_image_id)
        batch.set_input_string(1, str(i) + ".expected_edge_image.jpg")
        batch.run_process()
bvxm_batch.set_input_from_db(0, lidar_height)
bvxm_batch.set_input_string(1, "output_lidar_height.tif")
bvxm_batch.run_process()

bvxm_batch.init_process("vilSaveImageViewProcess")
bvxm_batch.set_input_from_db(0, lidar_edges)
bvxm_batch.set_input_string(1, "output_lidar_edges.tif")
bvxm_batch.run_process()

bvxm_batch.init_process("bvxmUpdateEdgesLidarProcess")
bvxm_batch.set_input_from_db(0, lidar_height)
bvxm_batch.set_input_from_db(1, lidar_edges)
bvxm_batch.set_input_from_db(2, lidar_edges_prob)
bvxm_batch.set_input_from_db(3, lidar_camera)
bvxm_batch.set_input_from_db(4, world)
bvxm_batch.set_input_unsigned(5, 0)
bvxm_batch.run_process()

bvxm_batch.init_process("bvxmSaveEdgesRawProcess")
bvxm_batch.set_input_from_db(0, world)
bvxm_batch.set_input_string(1, "output_edges.raw")
bvxm_batch.set_input_float(2, 0)
bvxm_batch.set_input_unsigned(3, 0)
bvxm_batch.run_process()

# updating with LIDAR
print("Creating Lidar")
bvxm_batch.init_process("bvxmLidarInitProcess")
bvxm_batch.set_params_process("lidar_params.xml")
bvxm_batch.set_input_string(
    0, "C:/test_images/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif")
    bvxm_batch.set_params_process("./roi_params.xml")
    statuscode = bvxm_batch.run_process()
    print statuscode
    if statuscode:
        cropped_cam_id = bvxm_batch.commit_output(0)
        cropped_image_id = bvxm_batch.commit_output(1)
        uncertainty_id = bvxm_batch.commit_output(2)

        curr_scale = 0

        map_type = "10bins_1d_radial"
        print("Illumination Index")
        bvxm_batch.init_process("bvxmIllumIndexProcess")
        bvxm_batch.set_input_string(0, map_type)
        bvxm_batch.set_input_string(1, image_filename)
        bvxm_batch.set_input_unsigned(2, 8)
        bvxm_batch.set_input_unsigned(3, 0)
        bvxm_batch.run_process()
        bin_id = bvxm_batch.commit_output(0)

        app_type = "apm_mog_grey"

        if normalize_and_save == 1:
            # Normalizing images
            print(" Normalizing Image ")
            bvxm_batch.init_process("bvxmNormalizeImageProcess")
            bvxm_batch.set_params_process("./normalize.xml")
            bvxm_batch.set_input_from_db(0, cropped_image_id)
            bvxm_batch.set_input_from_db(1, cropped_cam_id)
            bvxm_batch.set_input_from_db(2, voxel_world_id)
            bvxm_batch.set_input_string(3, app_type)