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.
  • Analysis: histogram, perceptual_hash, extract_shape.
  • Reductions: reduce_sum, reduce_mean, reduce_std, reduce_max, reduce_min.

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.5.0.tar.gz (761.5 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.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.5 MB view details)

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

polars_cv-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

polars_cv-0.5.0-cp39-abi3-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: polars_cv-0.5.0.tar.gz
  • Upload date:
  • Size: 761.5 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.5.0.tar.gz
Algorithm Hash digest
SHA256 448d94f5eb3c69437f89ab3c72511b04387cfb8d4b40690795ddea34f0b1792e
MD5 06f4ba331e5d3f32cdfb5499c7e41070
BLAKE2b-256 c8a33e5a5d6b680ad8d7ba656749eb84e0da85c52d56d91b4949121ba78dbe49

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.5.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.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_cv-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e38c78f5601f48cbaf7be0046a52d5c2c36d7bf5b4b7e2338eee9146005e7ed5
MD5 a606112101eda2b1d8f4e15504dc51b6
BLAKE2b-256 55aa9eb7255c61f650bbe822506039f52c76ed1b02c1514928a3d7754ae74143

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.5.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.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_cv-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3950fa29b0665e6dfb7233a335104f23e135daf3eb50d01f60f9ad76cf96e42
MD5 58a68fb017d84efcc6584f61f3a75553
BLAKE2b-256 77e261e30c7ed8060b94e6fe98a2d25e986a55916a8b61820b7c6d63590b10fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.5.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.5.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_cv-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04de9e3ce6d7b9ea724e871d115ead81de5d83d086f95ee7d5157d75c2b170f6
MD5 d8664982460b37b94f44a4077ab93e71
BLAKE2b-256 e374c8b04b0eead940ed1e69d3e1c9cde0eeb906cc631ac44a232f8f33469d2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for polars_cv-0.5.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