Skip to main content

No project description provided

Project description

GitlabCIPipeline GitlabCICoverage Appveyor Pypi Downloads ReadTheDocs

The main webpage for this project is: https://gitlab.kitware.com/computer-vision/kwimage

The kwimage module handles low-level image operations at a high level.

The core kwimage is a functional library with image-related helper functions that are either unimplemented in or more have a more general interface then their opencv counterparts.

The kwimage module builds on kwarray and provides tools commonly needed when addressing computer vision problems. This includes functions for reading images, resizing, image warp transformations, run-length-encoding, and non-maximum-suppression.

The kwimage module is also the current home of my annotation data structures, which provide efficient ways to interoperate between different common annotation formats (e.g. different bounding box / polygon / point formats). These data structures have both a .draw and .draw_on method for overlaying visualizations on matplotlib axes or numpy image matrices respectively.

Read the docs at: http://kwimage.readthedocs.io/en/master/

The top-level API is:

from .algo import (available_nms_impls, daq_spatial_nms, non_max_supression,)
from .im_alphablend import (ensure_alpha_channel, overlay_alpha_images,
                            overlay_alpha_layers,)
from .im_color import (Color,)
from .im_core import (atleast_3channels, ensure_float01, ensure_uint255,
                      make_channels_comparable, normalize, num_channels,
                      padded_slice,)
from .im_cv2 import (convert_colorspace, gaussian_patch, imresize, imscale,
                     warp_affine,)
from .im_demodata import (checkerboard, grab_test_image,
                          grab_test_image_fpath,)
from .im_draw import (draw_boxes_on_image, draw_clf_on_image,
                      draw_line_segments_on_image, draw_text_on_image,
                      draw_vector_field, make_heatmask, make_orimask,
                      make_vector_field,)
from .im_filter import (fourier_mask, radial_fourier_mask,)
from .im_io import (imread, imwrite, load_image_shape,)
from .im_runlen import (decode_run_length, encode_run_length, rle_translate,)
from .im_stack import (stack_images, stack_images_grid,)
from .structs import (Boxes, Coords, Detections, Heatmap, Mask, MaskList,
                      MultiPolygon, Points, PointsList, Polygon, PolygonList,
                      Segmentation, SegmentationList, smooth_prob,)
from .transform import (Affine, Linear, Matrix, Projective, Transform,)
from .util_warp import (add_homog, remove_homog, subpixel_accum,
                        subpixel_align, subpixel_getvalue, subpixel_maximum,
                        subpixel_minimum, subpixel_set, subpixel_setvalue,
                        subpixel_slice, subpixel_translate, warp_image,
                        warp_points, warp_tensor,)

NOTE: THE KWIMAGE STRUCTS WILL EVENTUALLY MOVE TO THE KWANNOT REPO

The most notable feature of the kwimage module are the kwimage.structs objects. This includes the primitive Boxes, Mask, and Coords objects, The semi-primitive Points, Polygon structures, and the composite Heatmap and Detections structures (note: Heatmap is just a composite of array-like structures).

The primitive and semi-primitive objects store and manipulate annotation geometry, and the composite structures combine primitives into a single object that jointly manipulates the primitives using warp operations.

The Detections structure is a meta-structure that associates the other more primitive components, and allows a developer to compose them into something that represents objects of interest. The details of this composition are left up to the end-application.

The Detections object can also be “rasterized” and converted into a Heatmap object, which represents the same information, but is in a form that is more suitable for use when training convolutional neural networks. Likewise, the output of neural networks can be directly encoded in a kwimage.Heatmap object. The Heatmap.detect method can then be used to convert the dense heatmap representation into a spare Detections representation that is more suitable for use in an object-detection system. We note that the detect function is not a special detection algorithm. The detection algorithm (which is outside the scope of kwimage) produces the heatmap, and the detect method effectively “inverts” the rasterize procedure of Detections by finding peaks in the heatmap, and running non-maximum suppression.

This module contains data structures for three image annotation primitives:

  • Boxes # technically this could be made out of Coords, probably not for efficiency and decoupling

  • Mask # likewise this could be renamed to Raster

  • Coords #

These primative structures are used to define these metadata-containing composites:

  • Detections

  • Polygon

  • Heatmap

  • MultiPolygon

  • PolygonList

  • MaskList

All of these structures have a self.data attribute that holds a pointer to the underlying data representation.

Some of these structures have a self.format attribute describing the underlying data representation.

Most of the compositie strucutres also have a self.meta attribute, which holds user-level metadata (e.g. info about the classes).

Installation

There are a few small quirks with installing kwimage. There is an issue with the opencv python bindings such that we could rely on either the opencv-python or opencv-python-headless package. If you have either of these module already installed you can simply pip install kwimage without encountering any issues related to this. But if you do not already have a module that provides import cv2 installed, then you should install kwimage with one of the following “extra install” tags:

# We recommend using the headless version
pip install kwimage[headless]

# OR

# If other parts of your system depend on the opencv qt libs
# (this can conflict with pyqt5)
pip install kwimage[graphics]

On linux, pip install commands will download precompiled manylinux wheels. On other operating systems, or if you are installing from source, you may need to compile C-extension modules. However, there are equivalent python-only implementations of almost every c-extension. You can disable compilation or loading of c-extensions at compile or runtime by setting the environment variable: KWIMAGE_DISABLE_C_EXTENSIONS=1.

Also note, that when building from source, the build may fail if you not in a fresh state (related to skbuild-386. You can mitigate this by running python setup.py clean to remove build artifacts. Building from a clean environment should work.

A Note on GDAL

The kwimage library can use GDAL library for certain tasks (e.g. IO of geotiffs). GDAL can be a pain to install without relying on conda. Kitware also has a pypi index that hosts GDAL wheels for linux systems:

pip install --find-links https://girder.github.io/large_image_wheels GDAL

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

kwimage-0.7.12-py3-none-any.whl (223.8 kB view details)

Uploaded Python 3

kwimage-0.7.12-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (720.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

kwimage-0.7.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl (713.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686 manylinux: glibc 2.5+ i686

kwimage-0.7.12-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (719.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

kwimage-0.7.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl (711.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686 manylinux: glibc 2.5+ i686

kwimage-0.7.12-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (711.3 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

kwimage-0.7.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl (704.1 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686 manylinux: glibc 2.5+ i686

kwimage-0.7.12-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (711.4 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

kwimage-0.7.12-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl (704.7 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686 manylinux: glibc 2.5+ i686

File details

Details for the file kwimage-0.7.12-py3-none-any.whl.

File metadata

  • Download URL: kwimage-0.7.12-py3-none-any.whl
  • Upload date:
  • Size: 223.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.11

File hashes

Hashes for kwimage-0.7.12-py3-none-any.whl
Algorithm Hash digest
SHA256 39eb87b7d959e0fa9b7f0c870b4a66d0bdaf4b4c013df77b23782fefaf38dae9
MD5 99f5871c3d0f6e0a45e91c8ff8b1e861
BLAKE2b-256 3ab43ab0b15bde668d8844c340877714b8c5ecd43b93db5ddda2e1bb0e191d9a

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0969e78d87b2b8a78b2279dd1181f9ef5fde50ef78960eb196bdbd08446a5fe5
MD5 9c9667a3a60ac6798054b7407984387c
BLAKE2b-256 1a5d675e96b1b0d6a8bcab19d2e707ba340ea53399f3f1b67e6d7e97881cb837

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 83f58d31d95bbf5b60ce16e3569bcb21c363d0425954e3db0905a7e133d831e1
MD5 060d2dfe06be9d40dbe591b74472d915
BLAKE2b-256 2c77b559bd1c506ed0f229bf80958baee9ecc47c9d6b1a03298887a684f6359f

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0bed9381c8dcc550c6a96c04ad34b11da5e174a115cdbdd79665273aac0f2c00
MD5 48fe5ed2f8cc81e849fc49dc3c7b7375
BLAKE2b-256 9e1153561254654d552679f3d985a0de4f161ff07899eab3865de8f3c138a5e3

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 4fd7de89c577d9f9fea970a31847e7c6ead98411aa81353cc4bf2d0f41a6e8b3
MD5 56ee1bf3ae047a2e764f960538b79be0
BLAKE2b-256 52b8ad7e7ca06f35873138528d35ddf75565c9c63cd131ccd1da6a92f4fdfa20

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bbff76e8b6319a896756f11907894932a56d75b3343359af6e83ed6b0176e42d
MD5 3e150d870f4fa77ecf76f5a074451969
BLAKE2b-256 3a265f2b98f1514327db5b9a918f3875e352a178711ef429986655870841bfa6

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 579b8882308e0e5fd9204a863787c369790522ecc555f65aff335932c4f5a1e0
MD5 6977e34eb6f8f4372c2ec371cebf5fa4
BLAKE2b-256 e1ac416ed730eb4749bc8a8be529b02cad792099772530faecb2f94c8b4aef07

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1a1194ed692b235ad172843fa29da5a7121404a71aa628c2a514f20bea91fd2c
MD5 6d1cf384fc98ed8ab4333582b746b96a
BLAKE2b-256 663759dca9810287904a932d4512c1af6abc6e0633dba442bebab48066195888

See more details on using hashes here.

File details

Details for the file kwimage-0.7.12-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for kwimage-0.7.12-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 42e2cda63c76e2f783d593cd8324ca2914fd0446493abe834e7ea75eebfe30d0
MD5 1d61fb1a46feee49a086deedb3d84d4c
BLAKE2b-256 625e93c416cc7ba2aedf5089b99511527cc5dfa2b40831bd06b43b4e5d4cb777

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page