Exemplo n.º 1
0
def scene_resources(res,
                    lower_left_lon,
                    lower_left_lat,
                    upper_right_lon,
                    upper_right_lat,
                    scene_res_file,
                    band="PAN",
                    GSD_threshold=10.0,
                    pick_seeds=0,
                    n_seeds=0):
    bvxm_batch.init_process("volmQuerySatelliteResourcesProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_double(1, lower_left_lon)
    bvxm_batch.set_input_double(2, lower_left_lat)
    bvxm_batch.set_input_double(3, upper_right_lon)
    bvxm_batch.set_input_double(4, upper_right_lat)
    bvxm_batch.set_input_string(5, scene_res_file)
    bvxm_batch.set_input_string(6, band)
    # of 0, it returns all resources that intersect the box, otherwise, it
    # picks n_seeds among these resources
    bvxm_batch.set_input_bool(7, pick_seeds)
    bvxm_batch.set_input_int(8, n_seeds)
    bvxm_batch.set_input_double(9, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Exemplo n.º 2
0
def combine_height_map(height_map_folder, poly_roi, out_folder, size_in_degree = 0.0625, leaf_id = -1):
  bvxm_batch.init_process("volmCombineHeightMapProcess");
  bvxm_batch.set_input_string(0, height_map_folder);
  bvxm_batch.set_input_string(1, poly_roi);
  bvxm_batch.set_input_string(2, out_folder);
  bvxm_batch.set_input_float(3, size_in_degree);
  bvxm_batch.set_input_int(4, leaf_id);
  bvxm_batch.run_process();
Exemplo n.º 3
0
def correct_ransac_process2(res, cor_file, output_folder, pixel_radius, enforce_existing = 0):
  bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess2");
  bvxm_batch.set_input_from_db(0, res);
  bvxm_batch.set_input_string(1, cor_file);
  bvxm_batch.set_input_string(2, output_folder);
  bvxm_batch.set_input_float(3, pixel_radius);  ## pixel radius to count for inliers
  bvxm_batch.set_input_int(4, enforce_existing);  ## if 1: enforce to have at least 2 existing images
  statuscode = bvxm_batch.run_process();
  return statuscode;
Exemplo n.º 4
0
def update_edges(world, cropped_cam, cropped_edge_image, edge_prob_mask_size=21, edge_prob_mask_sigma=1.0, scale=0):
  bvxm_batch.init_process("bvxmUpdateEdgesProcess");
  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_unsigned(3,0);
  bvxm_batch.set_input_int(4, edge_prob_mask_size)
  bvxm_batch.set_input_float(5, edge_prob_mask_sigma)
#   bvxm_batch.set_params_process(update_params_xml); # "./bvxmUpdateEdgesProcess.xml");
  bvxm_batch.run_process();
Exemplo n.º 5
0
def load_geotiff_cam(tfw_filename, lvcs=0, utm_zone=0, utm_hemisphere=0):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess")
    bvxm_batch.set_input_string(0, tfw_filename)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(1, lvcs)
    bvxm_batch.set_input_int(2, utm_zone)
    bvxm_batch.set_input_unsigned(3, utm_hemisphere)
    bvxm_batch.run_process()
    (c_id, c_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemplo n.º 6
0
def load_geotiff_cam(tfw_filename, lvcs=0, utm_zone=0, utm_hemisphere=0):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess");
    bvxm_batch.set_input_string(0, tfw_filename);
    if lvcs != 0:
      bvxm_batch.set_input_from_db(1, lvcs);
    bvxm_batch.set_input_int(2, utm_zone);
    bvxm_batch.set_input_unsigned(3, utm_hemisphere);
    bvxm_batch.run_process();
    (c_id,c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
Exemplo n.º 7
0
def combine_height_map(height_map_folder,
                       poly_roi,
                       out_folder,
                       size_in_degree=0.0625,
                       leaf_id=-1):
    bvxm_batch.init_process("volmCombineHeightMapProcess")
    bvxm_batch.set_input_string(0, height_map_folder)
    bvxm_batch.set_input_string(1, poly_roi)
    bvxm_batch.set_input_string(2, out_folder)
    bvxm_batch.set_input_float(3, size_in_degree)
    bvxm_batch.set_input_int(4, leaf_id)
    bvxm_batch.run_process()
Exemplo n.º 8
0
def dsm_ground_estimation_edge(dsm_image, edge_img, invalid_pixel = -1.0, sample_size = 10):
  bvxm_batch.init_process("volmDsmGroundEstimationEdgeProcess")
  bvxm_batch.set_input_from_db(0, dsm_image)
  bvxm_batch.set_input_from_db(1, edge_img)
  bvxm_batch.set_input_int(2, sample_size)
  bvxm_batch.set_input_float(3, invalid_pixel)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    grd_img = dbvalue(id, type)
    return grd_img
  else:
    return None
Exemplo n.º 9
0
def scene_resources2(res, poly_kml, scene_res_file, band="PAN", GSD_threshold=10.0, pick_seeds=0, n_seeds=0):
  bvxm_batch.init_process("volmQuerySatelliteResourceKmlProcess");
  bvxm_batch.set_input_from_db(0, res);
  bvxm_batch.set_input_string(1, poly_kml);
  bvxm_batch.set_input_string(2, scene_res_file);
  bvxm_batch.set_input_string(3, band);
  bvxm_batch.set_input_bool(4, pick_seeds);
  bvxm_batch.set_input_int(5, n_seeds);
  bvxm_batch.set_input_double(6, GSD_threshold);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0)
  cnt = bvxm_batch.get_output_unsigned(id);
  return cnt;
Exemplo n.º 10
0
def correct_ransac_process2(res,
                            cor_file,
                            output_folder,
                            pixel_radius,
                            enforce_existing=0):
    bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess2")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, cor_file)
    bvxm_batch.set_input_string(2, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(3, pixel_radius)
    # if 1: enforce to have at least 2 existing images
    bvxm_batch.set_input_int(4, enforce_existing)
    statuscode = bvxm_batch.run_process()
    return statuscode
Exemplo n.º 11
0
def update_edges(world,
                 cropped_cam,
                 cropped_edge_image,
                 edge_prob_mask_size=21,
                 edge_prob_mask_sigma=1.0,
                 scale=0):
    bvxm_batch.init_process("bvxmUpdateEdgesProcess")
    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_unsigned(3, 0)
    bvxm_batch.set_input_int(4, edge_prob_mask_size)
    bvxm_batch.set_input_float(5, edge_prob_mask_sigma)
    #   bvxm_batch.set_params_process(update_params_xml); # "./bvxmUpdateEdgesProcess.xml");
    bvxm_batch.run_process()
Exemplo n.º 12
0
def scene_resources(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, scene_res_file, band="PAN", pick_seeds=0, n_seeds=0):
  bvxm_batch.init_process("volmQuerySatelliteResourcesProcess");
  bvxm_batch.set_input_from_db(0,res);
  bvxm_batch.set_input_double(1, lower_left_lon);
  bvxm_batch.set_input_double(2, lower_left_lat);
  bvxm_batch.set_input_double(3, upper_right_lon);
  bvxm_batch.set_input_double(4, upper_right_lat);
  bvxm_batch.set_input_string(5, scene_res_file);
  bvxm_batch.set_input_string(6, band);
  bvxm_batch.set_input_bool(7, pick_seeds);  ## of 0, it returns all resources that intersect the box, otherwise, it picks n_seeds among these resources
  bvxm_batch.set_input_int(8, n_seeds);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  cnt = bvxm_batch.get_output_unsigned(id);
  return cnt;
Exemplo n.º 13
0
def dsm_ground_estimation_edge(dsm_image,
                               edge_img,
                               invalid_pixel=-1.0,
                               sample_size=10):
    bvxm_batch.init_process("volmDsmGroundEstimationEdgeProcess")
    bvxm_batch.set_input_from_db(0, dsm_image)
    bvxm_batch.set_input_from_db(1, edge_img)
    bvxm_batch.set_input_int(2, sample_size)
    bvxm_batch.set_input_float(3, invalid_pixel)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        grd_img = dbvalue(id, type)
        return grd_img
    else:
        return None
Exemplo n.º 14
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
    bvxm_batch.init_process("bradGetSunAnglesDateTimeProcess")
    bvxm_batch.set_input_float(0, lat)
    bvxm_batch.set_input_float(1, lon)
    bvxm_batch.set_input_int(2, year)
    bvxm_batch.set_input_int(3, month)
    bvxm_batch.set_input_int(4, day)
    bvxm_batch.set_input_int(5, hour)
    bvxm_batch.set_input_int(6, minute)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    sun_az = bvxm_batch.get_output_float(id)
    bvxm_batch.remove_data(id)
    (id, type) = bvxm_batch.commit_output(1)
    sun_el = bvxm_batch.get_output_float(id)
    bvxm_batch.remove_data(id)
    return sun_az, sun_el
Exemplo n.º 15
0
def persp2genWmargin(pcam, ni, nj, margin, level=0):
    bvxm_batch.init_process("vpglConvertToGenericCameraWithMarginProcess")
    bvxm_batch.set_input_from_db(0, pcam)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.set_input_unsigned(3, level)
    bvxm_batch.set_input_int(4, margin)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    gcam = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    ni = bvxm_batch.get_output_unsigned(id)
    (id, type) = bvxm_batch.commit_output(2)
    nj = bvxm_batch.get_output_unsigned(id)
    (id, type) = bvxm_batch.commit_output(3)
    new_pers_cam = dbvalue(id, type)
    return (gcam, ni, nj, new_pers_cam)
Exemplo n.º 16
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
  bvxm_batch.init_process("bradGetSunAnglesDateTimeProcess")
  bvxm_batch.set_input_float(0,lat)
  bvxm_batch.set_input_float(1,lon)
  bvxm_batch.set_input_int(2,year)
  bvxm_batch.set_input_int(3,month)
  bvxm_batch.set_input_int(4,day)
  bvxm_batch.set_input_int(5,hour)
  bvxm_batch.set_input_int(6,minute)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  sun_az = bvxm_batch.get_output_float(id)
  bvxm_batch.remove_data(id)
  (id,type) = bvxm_batch.commit_output(1)
  sun_el = bvxm_batch.get_output_float(id)
  bvxm_batch.remove_data(id)
  return sun_az, sun_el
Exemplo n.º 17
0
def persp2genWmargin(pcam, ni, nj, margin, level=0) :
  bvxm_batch.init_process("vpglConvertToGenericCameraWithMarginProcess");
  bvxm_batch.set_input_from_db(0, pcam);
  bvxm_batch.set_input_unsigned(1, ni);
  bvxm_batch.set_input_unsigned(2, nj);
  bvxm_batch.set_input_unsigned(3, level);
  bvxm_batch.set_input_int(4, margin);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  gcam = dbvalue(id,type);
  (id,type) = bvxm_batch.commit_output(1);
  ni = bvxm_batch.get_output_unsigned(id);
  (id,type) = bvxm_batch.commit_output(2);
  nj = bvxm_batch.get_output_unsigned(id);
  (id,type) = bvxm_batch.commit_output(3);
  new_pers_cam = dbvalue(id,type);
  return (gcam, ni, nj, new_pers_cam);
Exemplo n.º 18
0
def resample_perspective_camera( cam, size0, size1 ):
  bvxm_batch.init_process("vpglResamplePerspectiveCameraProcess");
  bvxm_batch.set_input_from_db(0, cam);
  bvxm_batch.set_input_int(1, size0[0]);
  bvxm_batch.set_input_int(2, size0[1]);
  bvxm_batch.set_input_int(3, size1[0]);
  bvxm_batch.set_input_int(4, size1[1]);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  out = dbvalue(id,type);
  return out;
Exemplo n.º 19
0
def resample_perspective_camera(cam, size0, size1):
    bvxm_batch.init_process("vpglResamplePerspectiveCameraProcess")
    bvxm_batch.set_input_from_db(0, cam)
    bvxm_batch.set_input_int(1, size0[0])
    bvxm_batch.set_input_int(2, size0[1])
    bvxm_batch.set_input_int(3, size1[0])
    bvxm_batch.set_input_int(4, size1[1])
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out = dbvalue(id, type)
    return out
Exemplo n.º 20
0
def scene_resources2(res,
                     poly_kml,
                     scene_res_file,
                     band="PAN",
                     GSD_threshold=10.0,
                     pick_seeds=0,
                     n_seeds=0):
    bvxm_batch.init_process("volmQuerySatelliteResourceKmlProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, poly_kml)
    bvxm_batch.set_input_string(2, scene_res_file)
    bvxm_batch.set_input_string(3, band)
    bvxm_batch.set_input_bool(4, pick_seeds)
    bvxm_batch.set_input_int(5, n_seeds)
    bvxm_batch.set_input_double(6, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Exemplo n.º 21
0
def geo2generic(geocam, ni, nj, scene_height, level):
    bvxm_batch.init_process("vpglConvertGeoCameraToGenericProcess")
    bvxm_batch.set_input_from_db(0, geocam)
    bvxm_batch.set_input_int(1, ni)
    bvxm_batch.set_input_int(2, nj)
    bvxm_batch.set_input_double(3, scene_height)
    bvxm_batch.set_input_int(4, level)
    bvxm_batch.run_process()
    (c_id, c_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemplo n.º 22
0
def geo2generic(geocam, ni, nj, scene_height, level):
    bvxm_batch.init_process("vpglConvertGeoCameraToGenericProcess");
    bvxm_batch.set_input_from_db(0, geocam);
    bvxm_batch.set_input_int(1, ni);
    bvxm_batch.set_input_int(2, nj);
    bvxm_batch.set_input_double(3, scene_height);
    bvxm_batch.set_input_int(4, level);
    bvxm_batch.run_process();
    (c_id, c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id, c_type);
    return cam;
Exemplo n.º 23
0
def segment_image(img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  bvxm_batch.init_process("sdetSegmentImageProcess");
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.set_input_int(1,margin);
  bvxm_batch.set_input_int(2,neigh);
  bvxm_batch.set_input_float(3,weight_thres);
  bvxm_batch.set_input_float(4,sigma);
  bvxm_batch.set_input_int(5,min_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Exemplo n.º 24
0
def segment_image_using_height(img, height_img, weight_thres, margin=0, min_size=50, sigma=1, neigh=8):
    bvxm_batch.init_process("sdetSegmentUsingHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_from_db(1, height_img)
    bvxm_batch.set_input_int(2, margin)
    bvxm_batch.set_input_int(3, neigh)
    bvxm_batch.set_input_float(4, weight_thres)
    bvxm_batch.set_input_float(5, sigma)
    bvxm_batch.set_input_int(6, min_size)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    seg_img = dbvalue(id, type)
    return seg_img
Exemplo n.º 25
0
def segment_image_using_height2(img, height_img, edge_img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  bvxm_batch.init_process("sdetSegmentUsingHeightMapProcess2");
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.set_input_from_db(1,height_img);
  bvxm_batch.set_input_from_db(2,edge_img);
  bvxm_batch.set_input_int(3,margin);
  bvxm_batch.set_input_int(4,neigh);
  bvxm_batch.set_input_float(5,weight_thres);
  bvxm_batch.set_input_float(6,sigma);
  bvxm_batch.set_input_int(7,min_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Exemplo n.º 26
0
def segment_image_using_height(img,
                               height_img,
                               weight_thres,
                               margin=0,
                               min_size=50,
                               sigma=1,
                               neigh=8):
    bvxm_batch.init_process("sdetSegmentUsingHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_from_db(1, height_img)
    bvxm_batch.set_input_int(2, margin)
    bvxm_batch.set_input_int(3, neigh)
    bvxm_batch.set_input_float(4, weight_thres)
    bvxm_batch.set_input_float(5, sigma)
    bvxm_batch.set_input_int(6, min_size)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    seg_img = dbvalue(id, type)
    return seg_img