Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update datatypes to be compatible with numpy >= 1.20 #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundle_adjust/ba_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def save_heatmap_of_reprojection_error(img_path, p, err, input_ims_footprints_lo
track_err_interp = gaussian_filter(track_err_interp, sigma=smooth)

# apply mask of image footprints
mask = np.ones((height, width)).astype(np.bool)
mask = np.ones((height, width)).astype(bool)
for i, aoi_lonlat in enumerate(input_ims_footprints_lonlat):
aoi_utm = geo_utils.utm_geojson_from_lonlat_geojson(aoi_lonlat)
pts2d_utm = np.array(aoi_utm["coordinates"][0])
Expand Down
2 changes: 1 addition & 1 deletion bundle_adjust/feature_tracks/ft_opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def opencv_detect_SIFT(geotiff_path, mask_path=None, offset=None, tracks_config=

if mask_path is not None:
mask = np.load(mask_path)
pts2d_colrow = features_i[:, :2].astype(np.int)
pts2d_colrow = features_i[:, :2].astype(np.int32)
true_if_obs_inside_aoi = mask[pts2d_colrow[:, 1], pts2d_colrow[:, 0]] > 0
features_i = features_i[true_if_obs_inside_aoi, :]

Expand Down
2 changes: 1 addition & 1 deletion bundle_adjust/feature_tracks/ft_s2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def detect_features_image_sequence(geotiff_paths, mask_paths=None, offsets=None,
features_i = features_i[features_i[:, 2] > 1.85, :] # min scale allowed is 1.85
if mask_paths is not None:
mask = np.load(mask_paths[i])
pts2d_colrow = features_i[:, :2].astype(np.int)
pts2d_colrow = features_i[:, :2].astype(np.int32)
true_if_obs_inside_aoi = mask[pts2d_colrow[:, 1], pts2d_colrow[:, 0]] > 0
features_i = features_i[true_if_obs_inside_aoi, :]

Expand Down
4 changes: 2 additions & 2 deletions bundle_adjust/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ def load_image(path_to_geotiff, offset=None, equalize=False):
"""
if offset is None:
with rasterio.open(path_to_geotiff) as src:
im = src.read().astype(np.float)
im = src.read().astype(np.float32)
else:
y0, x0, h, w = offset["row0"], offset["col0"], offset["height"], offset["width"]
with rasterio.open(path_to_geotiff) as src:
im = src.read(window=((y0, y0 + h), (x0, x0 + w))).squeeze().astype(np.float)
im = src.read(window=((y0, y0 + h), (x0, x0 + w))).squeeze().astype(np.float32)

# we only work with 1-band images
if len(im.shape) > 2:
Expand Down