mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 01:24:08 +08:00
GDAL plugin added.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[gdal]
|
||||
description = Image reading via the GDAL Library (www.gdal.org)
|
||||
provides = imread
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
__all__ = ['imread']
|
||||
|
||||
import numpy as np
|
||||
|
||||
try:
|
||||
import osgeo.gdal as gdal
|
||||
except ImportError:
|
||||
raise ImportError("The GDAL Library could not be found. "
|
||||
"Please refer to http://www.gdal.org/ "
|
||||
"for further instructions.")
|
||||
|
||||
def imread(fname, dtype=None):
|
||||
"""Load an image from file.
|
||||
|
||||
"""
|
||||
ds = gdal.Open(fname)
|
||||
|
||||
return ds.ReadAsArray().astype(dtype)
|
||||
|
||||
Reference in New Issue
Block a user