Skip to content

Commit

Permalink
added rasterio
Browse files Browse the repository at this point in the history
  • Loading branch information
lcmrl committed Sep 9, 2024
1 parent 29ac027 commit 19ebf53
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/convert_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@

from PIL import Image
from deep_image_matching import logger


import rasterio as rio
def load_img(
path_to_img: str,
):
img = rio.open(path_to_img).read(1)
#print(img.shape);quit()
#img = cv2.imread(path_to_img, cv2.IMREAD_ANYDEPTH)
logger.debug(
"Image loaded with pillow .."
)
img = Image.open(path_to_img)
img = img.convert("L")
logger.info(f"Image mode: {img.mode}")
img = np.array(img)
logger.info(f"Image mode: {img.dtype}")
#logger.debug(
# "Image loaded with pillow .."
#)
#img = Image.open(path_to_img)
#img = img.convert("L")
#logger.info(f"Image mode: {img.mode}")
#img = np.array(img)
#logger.info(f"Image mode: {img.dtype}")

return img

Expand Down

0 comments on commit 19ebf53

Please sign in to comment.