示例#1
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
示例#2
0
def create_ortho_camera(world, is_utm=False):
    batch.init_process("bvxmCreateOrthoCameraProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_bool(1, is_utm)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    ortho_cam = dbvalue(id, type)
    return ortho_cam
示例#3
0
def create_ortho_camera(world, is_utm=False):
    batch.init_process("bvxmCreateOrthoCameraProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_bool(1, is_utm)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    ortho_cam = dbvalue(id, type)
    return ortho_cam
示例#4
0
def threshold_image(img, value, threshold_above=True):
    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.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
示例#5
0
def threshold_image(img, value, threshold_above=True):
    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.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id,type)
    return mask
示例#6
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
示例#7
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
示例#8
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()
示例#9
0
def threshold_image_inside(img, min_thres, max_thres, threshold_inside=True):
    bvxm_batch.init_process("vilThresholdImageInsideProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, min_thres)
    bvxm_batch.set_input_float(2, max_thres)
    bvxm_batch.set_input_bool(3, threshold_inside)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        mask = dbvalue(id, type)
        return mask
    else:
        return None
示例#10
0
def threshold_image_inside(img, min_thres, max_thres, threshold_inside=True):
  bvxm_batch.init_process("vilThresholdImageInsideProcess")
  bvxm_batch.set_input_from_db(0, img)
  bvxm_batch.set_input_float(1, min_thres)
  bvxm_batch.set_input_float(2, max_thres)
  bvxm_batch.set_input_bool(3, threshold_inside)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
  else:
    return None
示例#11
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()
示例#12
0
def roi_init(image_filename, cam, world, roi_init_params_xml, is_all_bits=False):
    batch.init_process("bvxmRoiInitProcess")
    batch.set_input_string(0, image_filename)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_bool(3, is_all_bits)
    # "bvxmRoiInitProcess.xml")
    batch.set_params_process(roi_init_params_xml)
    statuscode = batch.run_process()
    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)
        return statuscode, cropped_cam, cropped_image, uncertainty
    else:
        return statuscode, dbvalue(0, ""), dbvalue(0, ""), dbvalue(0, "")
示例#13
0
def roi_init(image_filename,
             cam,
             world,
             roi_init_params_xml,
             is_all_bits=False):
    batch.init_process("bvxmRoiInitProcess")
    batch.set_input_string(0, image_filename)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_bool(3, is_all_bits)
    # "bvxmRoiInitProcess.xml")
    batch.set_params_process(roi_init_params_xml)
    statuscode = batch.run_process()
    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)
        return statuscode, cropped_cam, cropped_image, uncertainty
    else:
        return statuscode, dbvalue(0, ""), dbvalue(0, ""), dbvalue(0, "")
示例#14
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
示例#15
0
def create_land_map(world, geo_folder, urban_folder, osm_folder, is_osm_pt, is_osm_region, is_osm_line, is_convert=True):
    batch.init_process("bvxmCreateLandMapProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, geo_folder)
    batch.set_input_string(2, urban_folder)
    batch.set_input_string(3, osm_folder)
    batch.set_input_bool(4, is_osm_pt)
    batch.set_input_bool(5, is_osm_line)
    batch.set_input_bool(6, is_osm_region)
    batch.set_input_bool(7, is_convert)
    result = batch.run_process()
    if result:
        (img_id, img_type) = batch.commit_output(0)
        land_img = dbvalue(img_id, img_type)
    else:
        land_img = 0
    return land_img
示例#16
0
def edge_detection(img, noise_multiplier = 1.5, smooth = 1.5, auto_threshold = False, junctionp = False, aggressive_junc_closure = False ):
  bvxm_batch.init_process("vilEdgeDetectionProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_float(1, noise_multiplier);
  bvxm_batch.set_input_float(2, smooth);
  bvxm_batch.set_input_bool(3, auto_threshold);
  bvxm_batch.set_input_bool(4, junctionp);
  bvxm_batch.set_input_bool(5, aggressive_junc_closure);
  status = bvxm_batch.run_process();
  if status:
    (id, type) = bvxm_batch.commit_output(0);
    edge_img = dbvalue(id, type);
    return edge_img;
  else:
    return 0;
示例#17
0
def create_land_map(world,
                    geo_folder,
                    urban_folder,
                    osm_folder,
                    is_osm_pt,
                    is_osm_region,
                    is_osm_line,
                    is_convert=True):
    batch.init_process("bvxmCreateLandMapProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, geo_folder)
    batch.set_input_string(2, urban_folder)
    batch.set_input_string(3, osm_folder)
    batch.set_input_bool(4, is_osm_pt)
    batch.set_input_bool(5, is_osm_line)
    batch.set_input_bool(6, is_osm_region)
    batch.set_input_bool(7, is_convert)
    result = batch.run_process()
    if result:
        (img_id, img_type) = batch.commit_output(0)
        land_img = dbvalue(img_id, img_type)
    else:
        land_img = 0
    return land_img
示例#18
0
def edge_detection(img,
                   noise_multiplier=1.5,
                   smooth=1.5,
                   auto_threshold=False,
                   junctionp=False,
                   aggressive_junc_closure=False):
    bvxm_batch.init_process("vilEdgeDetectionProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, noise_multiplier)
    bvxm_batch.set_input_float(2, smooth)
    bvxm_batch.set_input_bool(3, auto_threshold)
    bvxm_batch.set_input_bool(4, junctionp)
    bvxm_batch.set_input_bool(5, aggressive_junc_closure)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        edge_img = dbvalue(id, type)
        return edge_img
    else:
        return 0
        bvxm_batch.set_params_process("./bvxmDetectEdgesProcess.xml")
        bvxm_batch.run_process()
        (cropped_edge_image_id, cropped_edge_image) = bvxm_batch.commit_output(0)
        cropped_edge_image = dbvalue(cropped_edge_image_id, cropped_edge_image)

        bvxm_batch.init_process("vilSaveImageViewProcess")
        bvxm_batch.set_input_from_db(0, cropped_edge_image)
        bvxm_batch.set_input_string(
            1, "output_cropped_edge_image_" + str_pad + str(i) + ".jpg")
        bvxm_batch.run_process()

        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_from_db(4, uncertainty)
        bvxm_batch.set_input_unsigned(5, 0)
        bvxm_batch.run_process()
        (cam_id, cam_type) = bvxm_batch.commit_output(0)
        cam = dbvalue(cam_id, cam_type)
        (expected_edge_image_id, expected_edge_image_type) = bvxm_batch.commit_output(1)
        expected_edge_image = dbvalue(
            expected_edge_image_id, expected_edge_image_type)

        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)
示例#20
0
 bvxm_batch.run_process();
 cropped_edge_image_id = bvxm_batch.commit_output(0);
 print("Detect Scale");
 bvxm_batch.init_process("bvxmDetectScaleProcess");
 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);
 statuscode=bvxm_batch.run_process();
 curr_scale_id = bvxm_batch.commit_output(0);
  
 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_edge_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,curr_scale_id);
 bvxm_batch.set_params_process(python_path + "rpc_registration_parameters.xml");
 bvxm_batch.run_process();
 cam_id = bvxm_batch.commit_output(0);
 voxel_image_id = bvxm_batch.commit_output(1);
 
 print cam_id;
 
 print("Saving Image");
 bvxm_batch.init_process("SaveImageViewProcess");
 bvxm_batch.set_input_from_db(0,cropped_image_id);
 bvxm_batch.set_input_string(1,"./initial/ini"+str(i)+".png");
 bvxm_batch.run_process();
示例#21
0
        cropped_cam_id = batch.commit_output(0)
        cropped_image_id = batch.commit_output(1)
        uncertainty_id = batch.commit_output(2)

        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()
示例#22
0
        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)
        batch.run_process()
        (id, type) = batch.commit_output(0)
        corrected_cam = dbvalue(id, type)
        (id, type) = batch.commit_output(1)
        corrected_img = dbvalue(id, type)
        cam_name_local = "./camera" + str(i) + ".txt"

        print(" saving camera  ")
        batch.init_process("vpglSaveRationalCameraProcess")
        batch.set_input_from_db(0, corrected_cam)
        batch.set_input_string(1, cam_name_local)
        batch.run_process()