跳转到主要内容

提取图像的数据库级掩码并写入新文件。

项目描述

rio-ds-mask

一个用于提取图像数据集级别掩码的 Rasterio 插件。

https://travis-ci.org/geowurster/rio-ds-mask.svg?branch=master https://coveralls.io/repos/github/geowurster/rio-ds-mask/badge.svg?branch=master

用法

Usage: rio ds-mask [OPTIONS] INPUT OUTPUT

  Extract an image's dataset-level mask.

  Both output driver and datatype are derived from the input image if not
  given.

  In some cases this plugin alters GDAL's returned mask values.  When
  writing masks GDAL uses 0's for opaque and 255's for transparent, but when
  reading masks the returned value differs based on the image's datatype.  8
  bit images produce 8 bit masks where 0's are opaque and 255's are
  transparent, however 16 bit images use 0's for opaque and 1's for
  transparent, still stored as 8 bit.  If the image's datatype is 'int16' or
  'uint16' and the mask's maximum value is 1, then all 1's are translated to
  255's.  The mask's datatype is preserved.  I have not fully investigated
  all of GDAL's masking options to determine if the behavior is consistent.
  If it is found to be a deliberate choice then the normalization will be
  removed.

Options:
  -f, --format, --driver TEXT     Output format driver
  -t, --dtype [ubyte|uint8|uint16|int16|uint32|int32|float32|float64]
                                  Output data type.
  --co, --profile NAME=VALUE      Driver specific creation options.See the
                                  documentation for the selected output driver
                                  for more information.
  --help                          Show this message and exit.

此示例命令创建了一个单波段 uint8 图像,可以作为GDAL掩码波段使用,这意味着值为 255 的像素是透明的,值为 0 的像素是不透明的。图像是无损压缩并内部分块的。

$ rio ds-mask \
    --driver GTiff \
    tests/data/alpha.tif \
    mask.tif \
    --co COMPRESS=DEFLATE \
    --co TILED=YES

安装

首先 安装Rasterio,然后

$ pip install rio-ds-mask --user

开发

$ git clone https://github.com/geowurster/rio-ds-mask.git
$ cd rio-ds-mask
$ pip install -e .\[all\]
$ pytest --cov rio-ds-mask --cov-report term-missing

许可证

参见 LICENSE.txt

变更日志

参见 CHANGES.md

项目详情


下载文件

下载适用于您平台的应用程序文件。如果您不确定选择哪一个,请了解有关 安装包 的更多信息。

源分布

此版本没有可用的源分布文件。请参阅 生成分布存档的教程

构建分布

rio_ds_mask-1.2-py2.py3-none-any.whl (7.5 kB 查看哈希值)

上传时间 Python 2 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面