or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

color.mddata.mddrawing.mdexposure.mdfeatures.mdfiltering.mdindex.mdio.mdmeasurement.mdmorphology.mdrestoration.mdsegmentation.mdtransform.mdutilities.md
tile.json

tessl/pypi-scikit-image

Comprehensive image processing and computer vision library for Python with algorithms for filtering, morphology, segmentation, and feature detection

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/scikit-image@0.25.x

To install, run

npx @tessl/cli install tessl/pypi-scikit-image@0.25.0

index.mddocs/

scikit-image

A comprehensive Python library for image processing and computer vision. scikit-image provides a collection of algorithms for image processing including color space conversion, filtering, morphology, segmentation, feature detection, geometric transformations, and measurement operations. It serves as the foundational image processing library for the Python scientific ecosystem.

Package Information

  • Package Name: scikit-image
  • Language: Python
  • Installation: pip install scikit-image

Core Imports

import skimage

Common submodule imports:

from skimage import io, filters, morphology, segmentation
from skimage.feature import canny, corner_harris
from skimage.transform import resize, rotate
from skimage.measure import label, regionprops

Basic Usage

import numpy as np
from skimage import io, filters, morphology, measure

# Load an image
image = io.imread('path/to/image.jpg')

# Convert to grayscale if needed
from skimage.color import rgb2gray
gray_image = rgb2gray(image)

# Apply Gaussian filter for noise reduction
smooth = filters.gaussian(gray_image, sigma=1.0)

# Edge detection
edges = filters.sobel(smooth)

# Morphological operations
cleaned = morphology.remove_small_objects(edges > 0.1, min_size=100)

# Label connected components
labeled = measure.label(cleaned)
props = measure.regionprops(labeled)

# Basic measurements
for prop in props:
    print(f"Area: {prop.area}, Centroid: {prop.centroid}")

# Save processed image
io.imsave('processed_image.jpg', cleaned)

Architecture

scikit-image is organized into focused submodules, each targeting specific image processing domains:

  • Core Processing: Filtering, morphology, and transformations for fundamental image operations
  • Analysis & Measurement: Feature detection, region properties, and quantitative analysis
  • Color & Intensity: Color space conversion and intensity adjustment operations
  • Segmentation: Algorithms to partition images into meaningful regions
  • Input/Output: Flexible image reading and writing with format support
  • Utilities: Data type conversion, noise generation, and helper functions

This modular design enables selective imports and provides clear separation of concerns for different image processing workflows.

Capabilities

Color Space Conversion

Convert between different color representations including RGB, HSV, LAB, XYZ and specialized spaces for histological imaging and color analysis.

def rgb2gray(rgb): ...
def rgb2hsv(rgb): ...  
def rgb2lab(rgb, illuminant='D65', observer='2'): ...
def hsv2rgb(hsv): ...
def lab2rgb(lab, illuminant='D65', observer='2'): ...
def rgba2rgb(rgba, background=(1, 1, 1)): ...

Color Processing

Image Filtering and Enhancement

Apply filters for noise reduction, edge detection, sharpening, and enhancement. Includes Gaussian filters, edge detection operators, ridge filters, and thresholding methods.

def gaussian(image, sigma=1, **kwargs): ...
def sobel(image, mask=None, **kwargs): ...
def canny(image, sigma=1, low_threshold=None, **kwargs): ...
def threshold_otsu(image, nbins=256): ...
def median(image, disk=None, **kwargs): ...
def unsharp_mask(image, radius=1.0, amount=1.0, **kwargs): ...

Filtering

Morphological Operations

Perform morphological operations including erosion, dilation, opening, closing, and advanced operations with customizable structuring elements.

def erosion(image, footprint=None, **kwargs): ...
def dilation(image, footprint=None, **kwargs): ...
def opening(image, footprint=None, **kwargs): ...
def closing(image, footprint=None, **kwargs): ...
def skeletonize(image, method='lee'): ...
def remove_small_objects(ar, min_size=64, **kwargs): ...

Morphology

Geometric Transformations

Transform images through rotation, scaling, warping, and coordinate system transformations. Includes support for various transformation models and image pyramids.

def resize(image, output_shape, **kwargs): ...
def rotate(image, angle, **kwargs): ...
def rescale(image, scale, **kwargs): ...
def warp(image, inverse_map, **kwargs): ...
class AffineTransform(matrix=None, **kwargs): ...
class ProjectiveTransform(matrix=None, **kwargs): ...

Transformations

Image Segmentation

Partition images into regions using watershed, region growing, active contours, and superpixel algorithms for object detection and analysis.

def watershed(image, markers=None, **kwargs): ...
def random_walker(data, labels, **kwargs): ...
def slic(image, n_segments=100, **kwargs): ...
def felzenszwalb(image, scale=1, **kwargs): ...
def chan_vese(image, **kwargs): ...
def active_contour(image, snake, **kwargs): ...

Segmentation

Feature Detection and Description

Detect and describe image features including corners, edges, blobs, and keypoints. Includes modern feature descriptors like SIFT, ORB, and texture analysis methods.

def corner_harris(image, method='k', **kwargs): ...
def corner_peaks(image, **kwargs): ...
def blob_log(image, **kwargs): ...
def blob_dog(image, **kwargs): ...
class ORB(n_keypoints=500, **kwargs): ...
class SIFT(**kwargs): ...

Feature Detection

Image Measurement and Analysis

Measure geometric properties, analyze regions, compute image moments, and extract quantitative information from processed images.

def label(image, background=None, **kwargs): ...
def regionprops(label_image, intensity_image=None, **kwargs): ...
def find_contours(image, level=0.5, **kwargs): ...
def moments(image, order=3): ...
def centroid(image): ...
def perimeter(image, neighbourhood=4): ...

Measurement

Image Input/Output

Read and write images in various formats with support for image collections, metadata handling, and multi-frame images.

def imread(fname, **kwargs): ...
def imsave(fname, arr, **kwargs): ...
class ImageCollection(pattern, **kwargs): ...
def imread_collection(pattern, **kwargs): ...

Input/Output

Restoration and Denoising

Restore degraded images through deconvolution, denoising, and inpainting algorithms for image quality improvement.

def denoise_tv_chambolle(image, weight=0.1, **kwargs): ...
def denoise_bilateral(image, **kwargs): ...
def denoise_wavelet(image, **kwargs): ...
def richardson_lucy(image, psf, num_iter=50, **kwargs): ...
def inpaint_biharmonic(image, mask, **kwargs): ...

Restoration

Intensity and Exposure Adjustment

Adjust image intensity, perform histogram operations, and enhance image contrast for better visualization and analysis.

def rescale_intensity(image, in_range='image', out_range='dtype'): ...
def equalize_hist(image, nbins=256, mask=None): ...
def equalize_adapthist(image, kernel_size=None, **kwargs): ...
def adjust_gamma(image, gamma=1, gain=1): ...
def histogram(image, nbins=256, source_range='image', normalize=False): ...

Exposure

Drawing and Visualization

Create geometric shapes, draw on images, and generate synthetic test patterns for visualization and algorithm testing.

def line(r0, c0, r1, c1): ...
def circle_perimeter(r, c, radius, method='bresenham', shape=None): ...
def polygon(r, c, shape=None): ...
def disk(center, radius, shape=None): ...
def rectangle(start, end=None, extent=None, shape=None): ...
def set_color(image, coords, color, alpha=1): ...

Drawing

Test Data and Examples

Access example images and synthetic datasets for testing algorithms and learning image processing techniques.

def camera(): ...
def coins(): ...
def astronaut(): ...
def binary_blobs(length=512, blob_size_fraction=0.1, n_dim=2, **kwargs): ...
def checkerboard(): ...

Data

Utilities and Data Types

Convert between data types, generate noise, manipulate arrays, and access utility functions for image processing workflows.

def img_as_float(image, force_copy=False): ...
def img_as_uint(image, force_copy=False): ...
def img_as_ubyte(image, force_copy=False): ...
def random_noise(image, mode='gaussian', **kwargs): ...
def crop(ar, crop_width, **kwargs): ...
def montage(arr_in, **kwargs): ...

Utilities

Types

from typing import Union, Optional, Tuple, List, Dict, Any
from numpy.typing import NDArray
import numpy as np

# Core image type
Image = NDArray[np.number]

# Common parameter types
Sigma = Union[float, Tuple[float, ...]]
Footprint = Optional[NDArray[np.bool_]]
Shape = Tuple[int, ...]
ColorTuple = Tuple[float, float, float]