Skip to main content

A Polars plugin for vision/array operations

Project description

polars-cv

ℹ️ Note: This is a largely AI developed project and still in its early stages. Use at your own discretion.

A Polars plugin for high-performance vision and array operations.

Features

  • Modular Pipelines: Define image processing pipelines and apply them to DataFrame columns.
  • Expression Arguments: Use Polars expressions for dynamic, per-row parameters.
  • Zero-Copy Performance: Efficient memory management with stride-aware operations.
  • Multi-Domain: Seamlessly move between images, geometry (contours), and numeric results.

Installation

pip install polars-cv

Quick Start

import polars as pl
from polars_cv import Pipeline

# Define a pipeline and apply it to a column
pipe = Pipeline().source("image_bytes").resize(height=224, width=224).grayscale()

df = pl.DataFrame({"image": [img1_bytes, img2_bytes]})
result = df.with_columns(
    processed=pl.col("image").cv.pipe(pipe).sink("numpy")
)

Dynamic Pipelines

Use Polars expressions for per-row parameter values:

pipe = (
    Pipeline()
    .source("image_bytes")
    .resize(height=pl.col("target_h"), width=pl.col("target_w"))
    .crop(top=pl.col("crop_y"), left=pl.col("crop_x"), height=100, width=100)
)

df = pl.DataFrame({
    "image": [img1_bytes, img2_bytes],
    "target_h": [224, 256],
    "target_w": [224, 256],
    "crop_x": [10, 20],
    "crop_y": [5, 15],
})

result = df.with_columns(
    processed=pl.col("image").cv.pipe(pipe).sink("numpy")
)

Operations

  • Image: resize, grayscale, blur, threshold, crop, rotate, pad, flip.
  • Compute: normalize, scale, clamp, relu, cast.
  • Geometry: extract_contours, rasterize, area, perimeter, centroid, bounding_box.
  • Points: normalize, translate, scale, rotate, distance, manhattan_distance, distance_to_contour, signed_distance_to_contour, nearest_point_on_contour, angle_to, midpoint, interpolate, within_bbox.
  • Analysis: histogram, perceptual_hash, extract_shape.
  • Reductions: reduce_sum, reduce_mean, reduce_std, reduce_max, reduce_min, reduce_percentile.

For full details, see the Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_cv-0.8.0.tar.gz (745.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

polars_cv-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

polars_cv-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

polars_cv-0.8.0-cp39-abi3-macosx_11_0_arm64.whl (8.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file polars_cv-0.8.0.tar.gz.

File metadata

  • Download URL: polars_cv-0.8.0.tar.gz
  • Upload date:
  • Size: 745.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for polars_cv-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6904876dfd5f809d115f5110a53f44ade865ef8e2cc7050523ce47f8aea74317
MD5 d7e81eb7be480a532fd81ab38e1b9386
BLAKE2b-256 79b2af90fd23eba892a468ed9a9b39dd287539c777675c53e5a999b0d1be0e1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.8.0.tar.gz:

Publisher: publish.yml on heshamdar/polars-cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_cv-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_cv-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b5abedd80a13fe34eeb12c15165a776d98fae72c884e7a11b3f2b83d6b430b2
MD5 2d88a9f9ed6e0f3fc66492a2e9d9a64a
BLAKE2b-256 7c12419e1d4727cd06d307df2c1c2e464bebaadd2283e5b869a4613ab7b1d1b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on heshamdar/polars-cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_cv-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_cv-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 17e809b88edd95548ad985295863252946af42af1cf158746e1d0f3c3f6852ce
MD5 435008209574168b8f8a30721d44bbaa
BLAKE2b-256 38e2f3d49daa8ee6ea2a7831ebbe3dfa926e6f81336c8ae51bf86262854ca7fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on heshamdar/polars-cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polars_cv-0.8.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_cv-0.8.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f552fa33570c266951d40f79ebe1c81752544be117137ed44c9142dd35b91374
MD5 2083f60f7205b09395049a71b43ba3c5
BLAKE2b-256 3b8abed2ad61b497a1bd7dd2d77918ae5c667e9d6e42fdb2967070569988157c

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.8.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on heshamdar/polars-cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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