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
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
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
def image_range(img): bvxm_batch.init_process('vilImageRangeProcess') bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) minVal = bvxm_batch.get_output_float(id) (id,type) = bvxm_batch.commit_output(1) maxVal = bvxm_batch.get_output_float(id) return minVal, maxVal
def arf_stream(file_path) : bvxm_batch.init_process("bilCreateArfImageIstreamProcess") bvxm_batch.set_input_string(0,file_path); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); stream = dbvalue(id, type); (id, type) = bvxm_batch.commit_output(1); numImgs = bvxm_batch.get_output_int(id); return stream, numImgs
def arf_next_frame(rawStream) : bvxm_batch.init_process("bilArfReadFrameProcess") bvxm_batch.set_input_from_db(0,rawStream); 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
def image_range(img): bvxm_batch.init_process('vilImageRangeProcess') bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) minVal = bvxm_batch.get_output_float(id) (id, type) = bvxm_batch.commit_output(1) maxVal = bvxm_batch.get_output_float(id) return minVal, maxVal
def image_size(img): bvxm_batch.init_process('vilImageSizeProcess') bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(1) nj = bvxm_batch.get_output_unsigned(id) return ni, nj
def arf_next_frame(rawStream): bvxm_batch.init_process("bilArfReadFrameProcess") bvxm_batch.set_input_from_db(0, rawStream) 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
def arf_stream(file_path): bvxm_batch.init_process("bilCreateArfImageIstreamProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) stream = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) numImgs = bvxm_batch.get_output_int(id) return stream, numImgs
def image_size(img): bvxm_batch.init_process('vilImageSizeProcess') bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) ni = bvxm_batch.get_output_unsigned(id) (id,type) = bvxm_batch.commit_output(1) nj = bvxm_batch.get_output_unsigned(id) return ni,nj
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
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
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
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
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;
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
def scene_origin(scene): batch.init_process("bvxmSceneOriginProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) lower_left_lon = batch.get_output_double(id) (id, type) = batch.commit_output(1) lower_left_lat = batch.get_output_double(id) (id, type) = batch.commit_output(2) lower_left_z = batch.get_output_double(id) return lower_left_lon, lower_left_lat, lower_left_z
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
def render_height_map(world): print("Rendering height map") batch.init_process("bvxmHeightmapOrthoProcess") batch.set_input_from_db(0, world) batch.run_process() (id, type) = batch.commit_output(0) out_d_img = dbvalue(id, type) (id, type) = batch.commit_output(1) out_h_img = dbvalue(id, type) (id, type) = batch.commit_output(2) out_conf_img = dbvalue(id, type) return out_h_img, out_d_img, out_conf_img
def bae_raw_stream(file_path,ni=0,nj=0,pixelsize=0) : bvxm_batch.init_process("bilCreateRawImageIstreamProcess") bvxm_batch.set_input_string(0,file_path); bvxm_batch.set_input_int(1,ni); bvxm_batch.set_input_int(2,nj); bvxm_batch.set_input_int(3,pixelsize); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); stream = dbvalue(id, type); (id, type) = bvxm_batch.commit_output(1); numImgs = bvxm_batch.get_output_int(id); return stream, numImgs
def bae_raw_stream(file_path, ni=0, nj=0, pixelsize=0): bvxm_batch.init_process("bilCreateRawImageIstreamProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.set_input_int(1, ni) bvxm_batch.set_input_int(2, nj) bvxm_batch.set_input_int(3, pixelsize) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) stream = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) numImgs = bvxm_batch.get_output_int(id) return stream, numImgs
def bvxm_load_image(file_path) : bvxm_batch.init_process("vilLoadImageViewProcess"); bvxm_batch.set_input_string(0, file_path); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); (ni_id, ni_type) = bvxm_batch.commit_output(1); (nj_id, nj_type) = bvxm_batch.commit_output(2); ni = bvxm_batch.get_output_unsigned(ni_id); nj = bvxm_batch.get_output_unsigned(nj_id); img = dbvalue(id,type); bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj;
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
def bvxm_load_image(file_path): bvxm_batch.init_process("vilLoadImageViewProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) (ni_id, ni_type) = bvxm_batch.commit_output(1) (nj_id, nj_type) = bvxm_batch.commit_output(2) ni = bvxm_batch.get_output_unsigned(ni_id) nj = bvxm_batch.get_output_unsigned(nj_id) img = dbvalue(id, type) bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj
def detect_shadow_ridge(region_img,blob_size_t, sun_angle) : bvxm_batch.init_process("vilShadowRidgeDetectionProcess"); bvxm_batch.set_input_from_db(0,region_img) bvxm_batch.set_input_int(1, blob_size_t); bvxm_batch.set_input_float(2, sun_angle); bvxm_batch.run_process(); (o_id,o_type) = bvxm_batch.commit_output(0); region_img = dbvalue(o_id,o_type); (o_id,o_type) = bvxm_batch.commit_output(1); out_img = dbvalue(o_id,o_type); (o_id,o_type) = bvxm_batch.commit_output(2); dist_img = dbvalue(o_id,o_type); return region_img, out_img, dist_img;
def bvxm_load_image_resource(file_path) : bvxm_batch.init_process("vilLoadImageResourceProcess"); bvxm_batch.set_input_string(0, file_path); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); (ni_id, ni_type) = bvxm_batch.commit_output(1); (nj_id, nj_type) = bvxm_batch.commit_output(2); ni = bvxm_batch.get_output_unsigned(ni_id); nj = bvxm_batch.get_output_unsigned(nj_id); img = dbvalue(id,type); bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj;
def bvxm_load_image_resource(file_path): bvxm_batch.init_process("vilLoadImageResourceProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) (ni_id, ni_type) = bvxm_batch.commit_output(1) (nj_id, nj_type) = bvxm_batch.commit_output(2) ni = bvxm_batch.get_output_unsigned(ni_id) nj = bvxm_batch.get_output_unsigned(nj_id) img = dbvalue(id, type) bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj
def detect_shadow_ridge(region_img, blob_size_t, sun_angle): bvxm_batch.init_process("vilShadowRidgeDetectionProcess") bvxm_batch.set_input_from_db(0, region_img) bvxm_batch.set_input_int(1, blob_size_t) bvxm_batch.set_input_float(2, sun_angle) bvxm_batch.run_process() (o_id, o_type) = bvxm_batch.commit_output(0) region_img = dbvalue(o_id, o_type) (o_id, o_type) = bvxm_batch.commit_output(1) out_img = dbvalue(o_id, o_type) (o_id, o_type) = bvxm_batch.commit_output(2) dist_img = dbvalue(o_id, o_type) return region_img, out_img, dist_img
def gradient(img): bvxm_batch.init_process('vilGradientProcess') bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() #x image (id, type) = bvxm_batch.commit_output(0) dIdx = dbvalue(id, type) #y image (id, type) = bvxm_batch.commit_output(1) dIdy = dbvalue(id, type) #mag image (id, type) = bvxm_batch.commit_output(2) magImg = dbvalue(id, type) return dIdx, dIdy, magImg
def gradient(img) : bvxm_batch.init_process('vilGradientProcess') bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() #x image (id,type) = bvxm_batch.commit_output(0) dIdx = dbvalue(id,type) #y image (id,type) = bvxm_batch.commit_output(1) dIdy = dbvalue(id,type) #mag image (id,type) = bvxm_batch.commit_output(2) magImg = dbvalue(id,type) return dIdx, dIdy, magImg
def bvxm_load_image_resource(file_path): bvxm_batch.init_process("vilLoadImageResourceProcess") bvxm_batch.set_input_string(0, file_path) status = bvxm_batch.run_process() if not status: return None, 0, 0 (id, type) = bvxm_batch.commit_output(0) (ni_id, ni_type) = bvxm_batch.commit_output(1) (nj_id, nj_type) = bvxm_batch.commit_output(2) ni = bvxm_batch.get_output_unsigned(ni_id) nj = bvxm_batch.get_output_unsigned(nj_id) img = dbvalue(id, type) bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj
def bvxm_load_image(file_path): bvxm_batch.init_process("vilLoadImageViewProcess") bvxm_batch.set_input_string(0, file_path) status = bvxm_batch.run_process() if not status: return None, 0, 0 (id, type) = bvxm_batch.commit_output(0) (ni_id, ni_type) = bvxm_batch.commit_output(1) (nj_id, nj_type) = bvxm_batch.commit_output(2) ni = bvxm_batch.get_output_unsigned(ni_id) nj = bvxm_batch.get_output_unsigned(nj_id) img = dbvalue(id, type) bvxm_batch.remove_data(ni_id) bvxm_batch.remove_data(nj_id) return img, ni, nj
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
def nitf_date_time(image_filename): bvxm_batch.init_process("vilNITFDateTimeProcess"); bvxm_batch.set_input_string(0,image_filename); bvxm_batch.run_process(); (id,type)=bvxm_batch.commit_output(0); year = bvxm_batch.get_output_int(id); (id,type)=bvxm_batch.commit_output(1); month = bvxm_batch.get_output_int(id); (id,type)=bvxm_batch.commit_output(2); day = bvxm_batch.get_output_int(id); (id,type)=bvxm_batch.commit_output(3); hour = bvxm_batch.get_output_int(id); (id,type)=bvxm_batch.commit_output(4); minute = bvxm_batch.get_output_int(id); return year, month, day, hour, minute
def nitf_date_time(image_filename): bvxm_batch.init_process("vilNITFDateTimeProcess") bvxm_batch.set_input_string(0, image_filename) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) year = bvxm_batch.get_output_int(id) (id, type) = bvxm_batch.commit_output(1) month = bvxm_batch.get_output_int(id) (id, type) = bvxm_batch.commit_output(2) day = bvxm_batch.get_output_int(id) (id, type) = bvxm_batch.commit_output(3) hour = bvxm_batch.get_output_int(id) (id, type) = bvxm_batch.commit_output(4) minute = bvxm_batch.get_output_int(id) return year, month, day, hour, minute
def get_number_of_planes(img): bvxm_batch.init_process("vilGetNumberOfPlanesProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) n_planes = bvxm_batch.get_output_unsigned(id) return n_planes
def histogram_equalize(img): bvxm_batch.init_process("vilHistogramEqualizeProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_equalized = dbvalue(id, type) return img_equalized
def model_dir(scene): batch.init_process("bvxmSceneModelDirProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) model_dir = batch.get_output_string(id) return model_dir
def remove_nitf_margin(img_res): bvxm_batch.init_process("vilNITFRemoveMarginProcess") bvxm_batch.set_input_from_db(0, img_res) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) vi = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(1) vj = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(2) vni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(3) vnj = bvxm_batch.get_output_unsigned(id) return vi, vj, vni, vnj else: return 0, 0, 0, 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
def fill_holes(img): bvxm_batch.init_process("vilFillHolesInRegionsProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def fill_holes(img): bvxm_batch.init_process("vilFillHolesInRegionsProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type); return outimg
def debayer(img): bvxm_batch.init_process("vilDebayerBGGRToRGBProcess") bvxm_batch.set_input_from_db(0,img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); outimg = dbvalue(id,type); return outimg;
def rgb_to_grey(img): bvxm_batch.init_process("vilRGBToGreyProcess"); bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type); return outimg
def get_number_of_planes(img): bvxm_batch.init_process("vilGetNumberOfPlanesProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); n_planes = bvxm_batch.get_output_unsigned(id) return n_planes;
def debayer(img): bvxm_batch.init_process("vilDebayerBGGRToRGBProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def rgb_to_grey(img): bvxm_batch.init_process("vilRGBToGreyProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
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
def create_scene_large_scale(roi_kml, scene_root, world_dir, dem_folder, world_size=500.0, voxel_size=1.0, height_diff=120.0, height_sub=25.0, land_folder=""): batch.init_process("bvxmCreateSceneXmlLargeScaleProcess") batch.set_input_string(0, roi_kml) batch.set_input_string(1, scene_root) batch.set_input_string(2, world_dir) batch.set_input_string(3, dem_folder) batch.set_input_string(4, land_folder) batch.set_input_float(5, world_size) batch.set_input_float(6, voxel_size) batch.set_input_float(7, height_diff) batch.set_input_float(8, height_sub) status = batch.run_process() if status: (id, type) = batch.commit_output(0) n_scenes = batch.get_output_unsigned(id) return n_scenes else: return 0
def histogram_equalize(img): bvxm_batch.init_process("vilHistogramEqualizeProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); img_equalized = dbvalue(id, type); return img_equalized;
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
def convert_image(img, type="byte") : bvxm_batch.init_process("vilConvertPixelTypeProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.set_input_string(1, type); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cimg = dbvalue(id,type); return cimg;