A friendly remote sensing data library
Project description
Author: Xuan Yang
E-mail: yangxuan.ac#gmail.com
yimage is a friendly remote sensing data library for Python. It encapsulates OpenCV library and GDAL library, and uses OpenCV data format as a standard to provide a convenient remote sensing data I/O interface.
Installation
pip install yimage
Prerequisites
Numpy
pip install numpy
OpenCV
pip install opencv-python
GDAL
pip install GDAL
conda install GDAL (We recommand this one)
(if missing libpoppler.so when import gdal, try running conda install "poppler<0.62")
Cython
pip install Cython
Document
<package> yimage
use import yimage to import this package.
use yimage.__version__ to check the version.
<class> io
yimage.io.read_image(filename, driver='GDAL', read_range=None, with_geo_info=False, only_image_info=False)
Reading an image file from disk by GDAL or OpenCV.
image array format: (H, W) or (H, W, C). band order: (b, g, r, nir, …)
Return: [numpy array] or [numpy array, geo info dict] or [image info dict] or [image info dict, geo info dict]
filename: [filename]
driver: [GDAL], [OpenCV]
read_range: [None] if you want to load the whole image, [(xoff, yoff, xsize, ysize)] if you want to load the part of image (same parameters as ReadAsArray method of GDAL library)
with_geo_info: [False] only returns the numpy array, [True] returns numpy array and geo info dict (‘proj’ and ‘coord’)
only_image_info: [False] returns numpy array, [True] returns image info dict. And it maybe returns geo info dict if with_geo_info is True
yimage.io.img_ordered_by_band_list(img, band_list)
Reordering bands by a list.
Return: [reordered numpy array]
img: [numpy array]
band_list: [list] e.g. [1, 2, 3] for true color image, [2, 3, 4] for pseudo color image
yimage.io.write_image(filename, img, driver='GDAL', dtype='uint8', gdal_driver='GTiff', img_geo_info=None, color_table=None, no_data_value=None)
Writing an image file to disk by GDAL or OpenCV.
image array format: (H, W) or (H, W, C). band order: (b, g, r, nir, …)
Return: [True] for success, [False] for failed.
filename: [filename]
img: [numpy array]
driver: [GDAL], [OpenCV]
dtype: [uint8], [uint16], [int16], [uint32], [int32], [float32], [float64]
gdal_driver: [Gtiff] GeoTIFF format, [ENVI] ENVI Standard foemat, [HFA] ERDAS format, and also, supports all formats that supported by GDAL library, please see the docs of GDAL for more driver name string.
img_geo_info: [None], [geo info dict] dict (‘proj’ and ‘coord’)
color_table: [None], [color tabel list] for coloring single band image
no_data_value: [None], [an integer] for setting NoDataValue
yimage.io.polygonize(raster_filename, shapefile_filename, band=None, layer_name=None)
Polygonize a raster data.
Return: [True] for success, [False] for failed.
raster_filename: [filename for raster data]
shapefile_filename: [filename for ESRI shapefile]
band: [None] polygonize the 1st band, [an integer] polygonize that band
layer_name: [None] the layer name of shapefile will be ‘polygon’, [name string]
yimage.io.load_color_table_file(filename)
Load color table from file.
Return: [color table list]
filename: [filename for color table file]
file format: one color RGB value with comment per line. Demo:
255 / 0 / 0 # Color 1
0 / 255 / 0 # Color 2
0 / 0 / 255 # Color 3
Updates
Version 1.0.3 (06/20/2020)
Added getting image info and geo info only without reading image data
Fixed a bug in write_image
Version 1.0.2 (06/19/2020)
Added default value of driver in write_image
Version 1.0.1 (06/12/2020)
offset method in write_image is deprecated
Version 1.0.0 (06/12/2020)
Support reading and writing remote sensing data
Support reordering bands of data
Support polygonizing the raster data
Support processing color table file
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for yimage-1.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f68ab0880de74f116cc9a543ac83b49168f59f39da9079b12668b9ab092ada |
|
MD5 | a8c9030579e5d163b9c66a5c6c16afff |
|
BLAKE2b-256 | 6e4ff8fabae4873957d71305086e7c74ffd762cf4bc90b6bd0cb9b4861d9b0a3 |
Hashes for yimage-1.0.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac544919a942c5c6adb6477122102cc94ef4a46ded6955e73730b962c7e5b64 |
|
MD5 | ba920ef571cb863640f431f36935f198 |
|
BLAKE2b-256 | e2ce645c36e989ffa60482d72e1ef13cfa7fb6050b8516688ca42a9f7f478c79 |
Hashes for yimage-1.0.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26811e281838e2c89c275fb6f3d411e12f504f548c6c0fbbccf703a1dda472a7 |
|
MD5 | 0a9e843a14e33eacbf530dafadf770d2 |
|
BLAKE2b-256 | 6512c49e5310aa0577da662f26785802726affb9276242a2225eb053c559d54b |
Hashes for yimage-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bf61ecb36d7e26c9f08c731cfed4d4465f574de78802767e13d12a1ff76fb61 |
|
MD5 | e36e0c00320da55ff247595ca69cc42e |
|
BLAKE2b-256 | 6955410667eec91e7cd61c06ae69ece78c514580a53b6bdd9a77f1017d021469 |
Hashes for yimage-1.0.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03fa9c76df631186bf4521d5656608f96c7682bcc38f5d38fa82e78047d71557 |
|
MD5 | 2567c2327be57f2550975408dceecedf |
|
BLAKE2b-256 | b1b5133622ae5d6b9d56c8e22e44a040a49af3e243532d4278f47fff433b1abe |
Hashes for yimage-1.0.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 595a236c36fd7bd57b2a95a5245770b3f7fde61b07f13b238f2d94382bd86848 |
|
MD5 | 482f4ad91e1daf97ca2da0417babaa61 |
|
BLAKE2b-256 | 6b6fc2e8c28c492dfc8b23f23153c858a2d2f7399c0cf28ee00bab7e4149d34a |
Hashes for yimage-1.0.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c83693bbb5d142a8946850098cb66ef05a9e06635fb12802bbdcdf598a5fcac |
|
MD5 | b44dd0e1f96bcb3b3914704fe639a9ad |
|
BLAKE2b-256 | 626386f8c0a95c0dfae97bb6469d87ae56788bbf9db551df6690af046838c7a4 |