You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skimage.io is deprecating imsave replace it with imagio.imwrite
Update of create_jpg
def create_jpg(
im_ms: np.array,
cloud_mask: np.array,
date: str,
satname: str,
filepath: str,
**kwargs,
) -> None:
"""
Saves a .jpg file with the RGB image as well as the NIR and SWIR1 grayscale images.
This functions can be modified to obtain different visualisations of the
multispectral images.
KV WRL 2018
Arguments:
-----------
im_ms: np.array
3D array containing the pansharpened/down-sampled bands (B,G,R,NIR,SWIR1)
cloud_mask: np.array
2D cloud mask with True where cloud pixels are
date: str
string containing the date at which the image was acquired
satname: str
name of the satellite mission (e.g., 'L5')
filepath: str
directory in which to save the images
Returns:
-----------
Saves a .jpg image corresponding to the preprocessed satellite image
"""
# rescale image intensity for display purposes
im_RGB = rescale_image_intensity(im_ms[:, :, [2, 1, 0]], cloud_mask, 99.9)
im_NIR = rescale_image_intensity(im_ms[:, :, 3], cloud_mask, 99.9)
im_SWIR = rescale_image_intensity(im_ms[:, :, 4], cloud_mask, 99.9)
# convert images to bytes so they can be saved
im_RGB = img_as_ubyte(im_RGB)
im_NIR = img_as_ubyte(im_NIR)
im_SWIR = img_as_ubyte(im_SWIR)
# Save each kind of image with skimage.io
file_types = ["RGB", "SWIR", "NIR"]
# create folders RGB, SWIR, and NIR to hold each type of image
for ext in file_types:
ext_filepath = filepath + os.sep + ext
if not os.path.exists(ext_filepath):
os.mkdir(ext_filepath)
# location to save image ex. rgb image would be in sitename/RGB/sitename.jpg
fname = os.path.join(ext_filepath, date + "_" + ext + "_" + satname + ".jpg")
if ext == "RGB":
imageio.imwrite(fname, im_RGB,quality=100)
if ext == "SWIR":
imageio.imwrite(fname, im_SWIR,quality=100)
if ext == "NIR":
imageio.imwrite(fname, im_NIR,quality=100)
The text was updated successfully, but these errors were encountered:
update SDS_preprocess.py.zip
Skimage.io is deprecating imsave replace it with imagio.imwrite
Update of create_jpg
The text was updated successfully, but these errors were encountered: