Exemplo n.º 1
0
def crop_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev, uncertainty):
  boxm2_batch.init_process("vpglCropImgUsing3DboxProcess");
  boxm2_batch.set_input_from_db(0, img_res);
  boxm2_batch.set_input_from_db(1, camera);
  boxm2_batch.set_input_double(2, lower_left_lon);
  boxm2_batch.set_input_double(3, lower_left_lat);
  boxm2_batch.set_input_double(4, lower_left_elev);
  boxm2_batch.set_input_double(5, upper_right_lon);
  boxm2_batch.set_input_double(6, upper_right_lat);
  boxm2_batch.set_input_double(7, upper_right_elev);
  boxm2_batch.set_input_double(8, uncertainty);
  status = boxm2_batch.run_process();
  if status:
    (id, type) = boxm2_batch.commit_output(0);
    local_cam  = dbvalue(id, type);
    (id, type) = boxm2_batch.commit_output(1);
    i0 = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(2);
    j0 = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(3);
    ni = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(4);
    nj = boxm2_batch.get_output_unsigned(id)
    return status, local_cam, i0, j0, ni, nj;
  else:
    return status, dbvalue(0, ""), 0, 0, 0, 0;
Exemplo n.º 2
0
def offset_cam_using_3d_box(camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev, uncertainty, lvcs=None):
  boxm2_batch.init_process("vpglOffsetCamUsing3DboxProcess");
  boxm2_batch.set_input_from_db(0, camera);
  boxm2_batch.set_input_double(1, lower_left_lon);
  boxm2_batch.set_input_double(2, lower_left_lat);
  boxm2_batch.set_input_double(3, lower_left_elev);
  boxm2_batch.set_input_double(4, upper_right_lon);
  boxm2_batch.set_input_double(5, upper_right_lat);
  boxm2_batch.set_input_double(6, upper_right_elev);
  boxm2_batch.set_input_double(7, uncertainty);
  if lvcs:
    boxm2_batch.set_input_from_db(8, lvcs);
  status = boxm2_batch.run_process();
  if status:
    (id, type) = boxm2_batch.commit_output(0);
    local_cam  = dbvalue(id, type);
    (id, type) = boxm2_batch.commit_output(1);
    i0 = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id);
    (id, type) = boxm2_batch.commit_output(2);
    j0 = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id);
    (id, type) = boxm2_batch.commit_output(3);
    ni = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id);
    (id, type) = boxm2_batch.commit_output(4);
    nj = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id);
    return status, local_cam, i0, j0, ni, nj;
  else:
    return status, dbvalue(0, ""), 0, 0, 0, 0;
Exemplo n.º 3
0
def test_classifier_clouds(tclsf, dictionary_name, image_resource, i, j, width, height, block_size, percent_cat_name, category_id_file=""):
  boxm2_batch.init_process("sdetTextureClassifySatelliteCloudsProcess");
  boxm2_batch.set_input_from_db(0, tclsf);
  boxm2_batch.set_input_string(1, dictionary_name);
  boxm2_batch.set_input_from_db(2, image_resource);
  boxm2_batch.set_input_unsigned(3, i);
  boxm2_batch.set_input_unsigned(4, j);
  boxm2_batch.set_input_unsigned(5, width);
  boxm2_batch.set_input_unsigned(6, height);
  boxm2_batch.set_input_unsigned(7, block_size);
  boxm2_batch.set_input_string(8, category_id_file);
  boxm2_batch.set_input_string(9, percent_cat_name);
  status = boxm2_batch.run_process();
  if status:
    (out_id, out_type)=boxm2_batch.commit_output(0);
    out_crop = dbvalue(out_id, out_type);
    (out_id, out_type)=boxm2_batch.commit_output(1);
    out_id_map = dbvalue(out_id, out_type);
    (out_id, out_type)=boxm2_batch.commit_output(2);
    out_rgb_map = dbvalue(out_id, out_type);
    (percent_id, percent_type) = boxm2_batch.commit_output(3);
    percent = boxm2_batch.get_output_float(percent_id);
    boxm2_batch.remove_data(percent_id)
    return out_crop, out_id_map, out_rgb_map, percent
  else:
    out_crop = 0;
    out_id_map = 0;
    out_rgb_map = 0;
    percent = 100;
    return out_crop, out_id_map, out_rgb_map, percent
Exemplo n.º 4
0
def crop_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev, uncertainty, lvcs=0):
    boxm2_batch.init_process("vpglCropImgUsing3DboxProcess")
    boxm2_batch.set_input_from_db(0, img_res)
    boxm2_batch.set_input_from_db(1, camera)
    boxm2_batch.set_input_double(2, lower_left_lon)
    boxm2_batch.set_input_double(3, lower_left_lat)
    boxm2_batch.set_input_double(4, lower_left_elev)
    boxm2_batch.set_input_double(5, upper_right_lon)
    boxm2_batch.set_input_double(6, upper_right_lat)
    boxm2_batch.set_input_double(7, upper_right_elev)
    boxm2_batch.set_input_double(8, uncertainty)
    if lvcs:
        boxm2_batch.set_input_from_db(9, lvcs)
    status = boxm2_batch.run_process()
    if status:
        (id, type) = boxm2_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = boxm2_batch.commit_output(1)
        i0 = boxm2_batch.get_output_unsigned(id)
        boxm2_batch.remove_data(id)
        (id, type) = boxm2_batch.commit_output(2)
        j0 = boxm2_batch.get_output_unsigned(id)
        boxm2_batch.remove_data(id)
        (id, type) = boxm2_batch.commit_output(3)
        ni = boxm2_batch.get_output_unsigned(id)
        boxm2_batch.remove_data(id)
        (id, type) = boxm2_batch.commit_output(4)
        nj = boxm2_batch.get_output_unsigned(id)
        boxm2_batch.remove_data(id)
        return status, local_cam, i0, j0, ni, nj
    else:
        return status, dbvalue(0, ""), 0, 0, 0, 0
Exemplo n.º 5
0
def blobwise_kl_div(p_img, q_img, blob_img, thresh=.1) :
  boxm2_batch.init_process("bripBlobwiseKLDivProcess")
  boxm2_batch.set_input_from_db(0, p_img);
  boxm2_batch.set_input_from_db(1, q_img);  
  boxm2_batch.set_input_from_db(2, blob_img);
  boxm2_batch.set_input_float(3, thresh); 
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  kl_img = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(1);
  thresh_img = dbvalue(id,type);
  return kl_img, thresh_img;
Exemplo n.º 6
0
def test_classifier(tclsf, block_size, category_id_file=""):
  boxm2_batch.init_process("sdetTextureClassifierProcess2");
  boxm2_batch.set_input_from_db(0, tclsf);
  boxm2_batch.set_input_unsigned(1, block_size);
  boxm2_batch.set_input_string(2, category_id_file);
  boxm2_batch.run_process();
  (out_id, out_type)=boxm2_batch.commit_output(0);
  out = dbvalue(out_id, out_type);
  (out_id, out_type)=boxm2_batch.commit_output(1);
  out_color = dbvalue(out_id, out_type);
  (out_id, out_type)=boxm2_batch.commit_output(2);
  out_id = dbvalue(out_id, out_type);
  return out, out_color, out_id
Exemplo n.º 7
0
def detect_shadow_ridge(region_img, blob_size_t, sun_angle):
    boxm2_batch.init_process("vilShadowRidgeDetectionProcess")
    boxm2_batch.set_input_from_db(0, region_img)
    boxm2_batch.set_input_int(1, blob_size_t)
    boxm2_batch.set_input_float(2, sun_angle)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    region_img = dbvalue(o_id, o_type)
    (o_id, o_type) = boxm2_batch.commit_output(1)
    out_img = dbvalue(o_id, o_type)
    (o_id, o_type) = boxm2_batch.commit_output(2)
    dist_img = dbvalue(o_id, o_type)
    return region_img, out_img, dist_img
Exemplo n.º 8
0
def get_xyz_from_depth_image(cam,depth_img):
  boxm2_batch.init_process("vpglGenerateXYZFromDepthImageProcess");
  boxm2_batch.set_input_from_db(0,cam); # perspective or generic camera
  boxm2_batch.set_input_from_db(1,depth_img);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  x_img = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(1);
  y_img = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(2);
  z_img = dbvalue(id,type);

  return x_img,y_img,z_img;
Exemplo n.º 9
0
def classify_image(eig, h_no, h_atmos, input_image_filename, tile_ni, tile_nj):
  boxm2_batch.init_process("bradClassifyImageProcess");
  boxm2_batch.set_input_from_db(0, eig);
  boxm2_batch.set_input_from_db(1, h_no);
  boxm2_batch.set_input_from_db(2, h_atmos);
  boxm2_batch.set_input_string(3, input_image_filename);
  boxm2_batch.set_input_unsigned(4, tile_ni);
  boxm2_batch.set_input_unsigned(5, tile_nj);
  boxm2_batch.run_process();
  (vid, vtype) = boxm2_batch.commit_output(0);
  q_img = dbvalue(vid, vtype);
  (vid, vtype) = boxm2_batch.commit_output(1);
  q_img_orig_size = dbvalue(vid, vtype);
  return q_img, q_img_orig_size
Exemplo n.º 10
0
def gradient(img):
    boxm2_batch.init_process('vilGradientProcess')
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    # x image
    (id, type) = boxm2_batch.commit_output(0)
    dIdx = dbvalue(id, type)
    # y image
    (id, type) = boxm2_batch.commit_output(1)
    dIdy = dbvalue(id, type)
    # mag image
    (id, type) = boxm2_batch.commit_output(2)
    magImg = dbvalue(id, type)
    return dIdx, dIdy, magImg
Exemplo n.º 11
0
def correct_cam_rotation(img, pcam, exp_img, cone_half_angle, n_steps, refine=True):
    boxm2_batch.init_process('icamCorrectCamRotationProcess')
    boxm2_batch.set_input_from_db(0,img)
    boxm2_batch.set_input_from_db(1,pcam)
    boxm2_batch.set_input_from_db(2,exp_img)
    boxm2_batch.set_input_float(3,cone_half_angle)
    boxm2_batch.set_input_unsigned(4,n_steps)
    boxm2_batch.set_input_bool(5,refine)
    boxm2_batch.run_process()
    (m_id,m_type) = boxm2_batch.commit_output(0)
    mapped_img = dbvalue(m_id,m_type);
    (c_id,c_type) = boxm2_batch.commit_output(1)
    corr_cam = dbvalue(c_id,c_type);
    return mapped_img, corr_cam
Exemplo n.º 12
0
def generate_roc(tclsf, class_out_prob_img, class_out_color_img, orig_img, prefix_for_bin_files, positive_category_name,category_id_file):
  boxm2_batch.init_process("sdetTextureClassifierROCProcess");
  boxm2_batch.set_input_from_db(0, tclsf);
  boxm2_batch.set_input_from_db(1, class_out_prob_img);
  boxm2_batch.set_input_from_db(2, class_out_color_img);
  boxm2_batch.set_input_from_db(3, orig_img);
  boxm2_batch.set_input_string(4, prefix_for_bin_files);
  boxm2_batch.set_input_string(5, positive_category_name);
  boxm2_batch.set_input_string(6, category_id_file);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  tp = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(1);
  tn = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(2);
  fp = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(3);
  fn = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(4);
  tpr = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(5);
  fpr = boxm2_batch.get_bbas_1d_array_float(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(6);
  outimg = dbvalue(id,type);
  return tp, tn, fp, fn, tpr, fpr, outimg;
Exemplo n.º 13
0
def load_classifier(classifier_name):
  boxm2_batch.init_process("sdetLoadTextureClassifierProcess");
  boxm2_batch.set_input_string(0,classifier_name);
  boxm2_batch.run_process();
  (tclsf_id, tclsf_type)=boxm2_batch.commit_output(0);
  tclsf = dbvalue(tclsf_id, tclsf_type);
  return tclsf
Exemplo n.º 14
0
def load_dictionary(dictionary_name):
  boxm2_batch.init_process("sdetLoadTextureDictionaryProcess");
  boxm2_batch.set_input_string(0,dictionary_name);
  boxm2_batch.run_process();
  (tclsf_id, tclsf_type)=boxm2_batch.commit_output(0);
  tclsf = dbvalue(tclsf_id, tclsf_type);
  return tclsf
Exemplo n.º 15
0
def load_mesh(filename):
  boxm2_batch.init_process("boxm2LoadMeshProcess");
  boxm2_batch.set_input_string(0,filename);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  mesh = dbvalue(id, type);
  return mesh;
Exemplo n.º 16
0
def BGR_to_RGB(inimg):
    boxm2_batch.init_process("vilBGRToRGBProcess")
    boxm2_batch.set_input_from_db(0, inimg)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemplo n.º 17
0
def initialize_rng(seed=0):
  boxm2_batch.init_process("bstaInitializeRandomSeedProcess");
  boxm2_batch.set_input_unsigned(0,seed);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0)
  rng = dbvalue(id,type)
  return rng
Exemplo n.º 18
0
def debayer(img):
    boxm2_batch.init_process("vilDebayerBGGRToRGBProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    outimg = dbvalue(id, type)
    return outimg
Exemplo n.º 19
0
def load_projective_camera(file_path):
    boxm2_batch.init_process("vpglLoadProjCameraProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemplo n.º 20
0
def load_local_rational_camera(file_path) :
  boxm2_batch.init_process("vpglLoadLocalRationalCameraProcess");
  boxm2_batch.set_input_string(0, file_path);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Exemplo n.º 21
0
def load_perspective_camera(file_path) :
  boxm2_batch.init_process("vpglLoadPerspectiveCameraProcess");
  boxm2_batch.set_input_string(0, file_path);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Exemplo n.º 22
0
def convert_local_rational_perspective_camera(local_cam) :
  boxm2_batch.init_process("vpglConvertLocalRationalToPerspectiveProcess");
  boxm2_batch.set_input_from_db(0, local_cam);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Exemplo n.º 23
0
def load_atmospheric_parameters(filename):
  boxm2_batch.init_process("bradLoadAtmosphericParametersProcess")
  boxm2_batch.set_input_string(0,filename)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  atm_params = dbvalue(id,type)
  return atm_params
Exemplo n.º 24
0
def load_rational_camera_nitf(file_path):
    boxm2_batch.init_process("vpglLoadRationalCameraNITFProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemplo n.º 25
0
def invert_float_image(img):
    boxm2_batch.init_process("vilInvertFloatImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    inverted_img = dbvalue(id, type)
    return inverted_img
Exemplo n.º 26
0
def histogram_equalize(img):
    boxm2_batch.init_process("vilHistogramEqualizeProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_equalized = dbvalue(id, type)
    return img_equalized
Exemplo n.º 27
0
def load_joint_hist3d(filename):
  boxm2_batch.init_process("bstaLoadJointHist3dProcess");
  boxm2_batch.set_input_string(0,filename);
  boxm2_batch.run_process();
  (h_id,h_type) = boxm2_batch.commit_output(0);
  h = dbvalue(h_id, h_type);
  return h
Exemplo n.º 28
0
def fill_holes(img):
    boxm2_batch.init_process("vilFillHolesInRegionsProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    outimg = dbvalue(id, type)
    return outimg
Exemplo n.º 29
0
def load_lvcs(lvcs_filename):
    boxm2_batch.init_process("vpglLoadLVCSProcess");
    boxm2_batch.set_input_string(0, lvcs_filename);
    boxm2_batch.run_process();
    (lvcs_id, lvcs_type) = boxm2_batch.commit_output(0);
    lvcs = dbvalue(lvcs_id, lvcs_type);
    return lvcs;
Exemplo n.º 30
0
def load_eigenspace(filename):
  boxm2_batch.init_process("bradLoadEigenspaceProcess");
  boxm2_batch.set_input_string(0, filename);
  boxm2_batch.run_process();
  (eig_id,eig_type)=boxm2_batch.commit_output(0);
  eig = dbvalue(eig_id, eig_type);
  return eig;
Exemplo n.º 31
0
def detect_shadow_rgb(img, threshold):
    boxm2_batch.init_process("vilShadowDetectionProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, threshold)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    region_img = dbvalue(o_id, o_type)
    return region_img
Exemplo n.º 32
0
def radiometrically_calibrate(cropped_image, meta):
    boxm2_batch.init_process("bradNITFAbsRadiometricCalibrationProcess")
    boxm2_batch.set_input_from_db(0, cropped_image)
    boxm2_batch.set_input_from_db(1, meta)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cropped_img_cal = dbvalue(id, type)
    return cropped_img_cal
Exemplo n.º 33
0
def convert_image(img, type="byte"):
    boxm2_batch.init_process("vilConvertPixelTypeProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_string(1, type)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cimg = dbvalue(id, type)
    return cimg
Exemplo n.º 34
0
def combine_eo_ir(eo_img, ir_img):
    boxm2_batch.init_process("vilEOIRCombineProcess")
    boxm2_batch.set_input_from_db(0, eo_img)
    boxm2_batch.set_input_from_db(1, ir_img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 35
0
def prob_as_expected(image, atomicity):
    boxm2_batch.init_process("bslExpectedImageProcess")
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, atomicity)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    image_prob = dbvalue(id, type)
    return image_prob
Exemplo n.º 36
0
def create_taylor_kernel(kernel_path):
    print "Creating Taylor Kernel: " + kernel_path
    boxm2_batch.init_process("bvplLoadTaylorKernelProcess")
    boxm2_batch.set_input_string(0, kernel_path)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    taylor_kernel = dbvalue(id, type)
    return taylor_kernel
Exemplo n.º 37
0
def scale_scene(scene, scale):
    boxm2_batch.init_process("boxm2ScaleSceneProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_float(1, scale)
    boxm2_batch.run_process()
    (scene_id, scene_type) = boxm2_batch.commit_output(0)
    scene = dbvalue(scene_id, scene_type)
    return scene
Exemplo n.º 38
0
def load_scene(scene_str):
    print("Loading a Scene from file: ", scene_str)
    boxm2_batch.init_process("boxm2LoadSceneProcess")
    boxm2_batch.set_input_string(0, scene_str)
    boxm2_batch.run_process()
    (scene_id, scene_type) = boxm2_batch.commit_output(0)
    scene = dbvalue(scene_id, scene_type)
    return scene
Exemplo n.º 39
0
def create_local_rational_camera(rational_cam_fname, lvcs_fname):
    boxm2_batch.init_process('vpglCreateLocalRationalCameraProcess')
    boxm2_batch.set_input_string(0, rational_cam_fname)
    boxm2_batch.set_input_string(1, lvcs_fname)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemplo n.º 40
0
def load_affine_camera(file_path, viewing_dist=1000):
    boxm2_batch.init_process("vpglLoadAffineCameraProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.set_input_double(1, viewing_dist)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemplo n.º 41
0
def persp2genWmargin(pcam, ni, nj, margin, level=0):
    boxm2_batch.init_process("vpglConvertToGenericCameraWithMarginProcess")
    boxm2_batch.set_input_from_db(0, pcam)
    boxm2_batch.set_input_unsigned(1, ni)
    boxm2_batch.set_input_unsigned(2, nj)
    boxm2_batch.set_input_unsigned(3, level)
    boxm2_batch.set_input_int(4, margin)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    gcam = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    ni = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(2)
    nj = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(3)
    new_pers_cam = dbvalue(id, type)
    return (gcam, ni, nj, new_pers_cam)
Exemplo n.º 42
0
def atmospheric_correct(image, sun_z):
    boxm2_batch.init_process('bbasAtmosphericCorrProcess')
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, sun_z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    image_corrected = dbvalue(id, type)
    return image_corrected
Exemplo n.º 43
0
def trajectory_direct(trajectory, index):
    boxm2_batch.init_process("boxm2ViewTrajectoryDirectProcess")
    boxm2_batch.set_input_from_db(0, trajectory)
    boxm2_batch.set_input_unsigned(1, index)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemplo n.º 44
0
def rotate_perspective_camera(cam_in, theta, phi):
    boxm2_batch.init_process('vpglRotatePerspCamProcess')
    boxm2_batch.set_input_from_db(0, cam_in)
    boxm2_batch.set_input_float(1, theta)
    boxm2_batch.set_input_float(2, phi)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    rot_cam = dbvalue(id, type)
    return rot_cam
Exemplo n.º 45
0
def load_geotiff_cam2(filename, ni, nj):
    boxm2_batch.init_process("vpglLoadGeoCameraProcess2")
    boxm2_batch.set_input_string(0, filename)
    boxm2_batch.set_input_unsigned(1, ni)
    boxm2_batch.set_input_unsigned(2, nj)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemplo n.º 46
0
def next_frame(rawStream):
    boxm2_batch.init_process("bilReadFrameProcess")
    boxm2_batch.set_input_from_db(0, rawStream)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img = dbvalue(id, type)
    #(id, type) = boxm2_batch.commit_output(1);
    #time = boxm2_batch.get_output_unsigned(id);
    return img
Exemplo n.º 47
0
def combine_planes(img_red, img_green, img_blue):
    boxm2_batch.init_process("vilCombinePlanesProcess")
    boxm2_batch.set_input_from_db(0, img_red)
    boxm2_batch.set_input_from_db(1, img_green)
    boxm2_batch.set_input_from_db(2, img_blue)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 48
0
def mask_image_using_id(img, id_img, input_id):
    boxm2_batch.init_process("vilMaskImageUsingIDsProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_from_db(1, id_img)
    boxm2_batch.set_input_unsigned(2, input_id)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    masked_img = dbvalue(id, type)
    return masked_img
Exemplo n.º 49
0
def fuse_beliefs(image1, image2, atomicity):
    boxm2_batch.init_process("bslFusionProcess")
    boxm2_batch.set_input_from_db(0, image1)
    boxm2_batch.set_input_from_db(1, image2)
    boxm2_batch.set_input_float(2, atomicity)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    fused_image = dbvalue(id, type)
    return fused_image
Exemplo n.º 50
0
def undistort_image(img, param_file, iters):
    boxm2_batch.init_process("vilUndistortImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_string(1, param_file)
    boxm2_batch.set_input_int(2, iters)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    out_img = dbvalue(o_id, o_type)
    return out_img
Exemplo n.º 51
0
def truncate_image(img, min_value, max_value):
    boxm2_batch.init_process("vilTruncateImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, min_value)
    boxm2_batch.set_input_float(2, max_value)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 52
0
def gradient_angle(Ix, Iy):
    boxm2_batch.init_process('vilGradientAngleProcess')
    boxm2_batch.set_input_from_db(0, Ix)
    boxm2_batch.set_input_from_db(1, Iy)
    boxm2_batch.run_process()
    # x image
    (id, type) = boxm2_batch.commit_output(0)
    angleImg = dbvalue(id, type)
    return angleImg
Exemplo n.º 53
0
def load_geotiff_from_header(filename, lvcs=0):
    boxm2_batch.init_process("vpglLoadGeotiffCamFromHeaderProcess")
    boxm2_batch.set_input_string(0, filename)
    if lvcs != 0:
        boxm2_batch.set_input_from_db(1, lvcs)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemplo n.º 54
0
def load_image_metadata(filename):
    boxm2_batch.init_process("bradLoadImageMetadataProcess")
    boxm2_batch.set_input_string(0, filename)
    status = boxm2_batch.run_process()
    mdata = None
    if status:
        (id, type) = boxm2_batch.commit_output(0)
        mdata = dbvalue(id, type)
    return mdata
Exemplo n.º 55
0
def translate_geo_camera(geocam, x, y):
    boxm2_batch.init_process("vpglTranslateGeoCameraProcess")
    boxm2_batch.set_input_from_db(0, geocam)
    boxm2_batch.set_input_double(1, x)
    boxm2_batch.set_input_double(2, y)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemplo n.º 56
0
def correct_rational_camera(cam_in, offset_x, offset_y):
    boxm2_batch.init_process('vpglCorrectRationalCameraProcess')
    boxm2_batch.set_input_from_db(0, cam_in)
    boxm2_batch.set_input_double(1, offset_x)
    boxm2_batch.set_input_double(2, offset_y)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    corrected_cam = dbvalue(id, type)
    return corrected_cam
Exemplo n.º 57
0
def binary_img_op(img1, img2, operation="sum"):
    boxm2_batch.init_process("vilBinaryImageOpProcess")
    boxm2_batch.set_input_from_db(0, img1)
    boxm2_batch.set_input_from_db(1, img2)
    boxm2_batch.set_input_string(2, operation)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    out = dbvalue(id, type)
    return out
Exemplo n.º 58
0
def bae_raw_stream(file_path):
    boxm2_batch.init_process("bilCreateRawImageIstreamProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    stream = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    numImgs = boxm2_batch.get_output_int(id)
    return stream, numImgs
Exemplo n.º 59
0
def solve_gain_offset(model_image, test_image, test_mask):
    boxm2_batch.init_process("bripSolveGainOffsetProcess")
    boxm2_batch.set_input_from_db(0, model_image)
    boxm2_batch.set_input_from_db(1, test_image)
    boxm2_batch.set_input_from_db(3, test_mask)
    boxm2_batch.run_process()
    (map_image_id, map_image_type) = boxm2_batch.commit_output(0)
    map_image = dbvalue(map_image_id, map_image_type)
    return map_image
Exemplo n.º 60
0
def threshold_image(img, value, threshold_above=True):
    boxm2_batch.init_process("vilThresholdImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, value)
    boxm2_batch.set_input_bool(2, threshold_above)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask