sentinelhub.decoding
Module for data decoding
- sentinelhub.decoding.decode_data(response_content, data_type)[source]
Interprets downloaded data and returns it.
- sentinelhub.decoding.decode_image(data, image_type)[source]
Decodes the image provided in various formats, i.e. png, 16-bit float tiff, 32-bit float tiff, jp2 and returns it as a numpy array
- sentinelhub.decoding.decode_image_with_pillow(stream)[source]
Decodes an image using Pillow package and handles potential warnings.
- sentinelhub.decoding.decode_jp2_image(stream)[source]
Tries to decode a JPEG2000 image using the Pillow package.
- Parameters:
stream (IO) – A binary stream format.
- Returns:
A numpy array representing an image of shape (height, width) or (height, width, channels).
- Return type:
ndarray
- sentinelhub.decoding.decode_tar(data)[source]
A decoder to convert response bytes into a dictionary of {filename: value}
- sentinelhub.decoding.decode_sentinelhub_err_msg(response)[source]
Decodes error message from Sentinel Hub service
- Parameters:
response (Response) – Sentinel Hub service response
- Returns:
An error message
- Return type:
- sentinelhub.decoding.get_jp2_bit_depth(stream)[source]
Reads a bit encoding depth of jpeg2000 file in binary stream format
- sentinelhub.decoding.fix_jp2_image(image, bit_depth)[source]
Because Pillow library incorrectly reads JPEG 2000 images with 15-bit encoding this function corrects the values in image.
- Parameters:
image (ndarray) – image read by opencv library
bit_depth (int) – A bit depth of jp2 image encoding
- Returns:
corrected image
- Return type:
ndarray