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.6.0.tar.gz (766.9 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.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

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

polars_cv-0.6.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.6.0-cp39-abi3-macosx_11_0_arm64.whl (7.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: polars_cv-0.6.0.tar.gz
  • Upload date:
  • Size: 766.9 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.6.0.tar.gz
Algorithm Hash digest
SHA256 0791899557349d6cd0ce66ad0162d7577b3376c7dea7934916c20954f09836cd
MD5 1df673b34557ff69916cdb00bc94d5b8
BLAKE2b-256 07dd79017d6dda8d7fdebde1c5829571e7ab104e497b85fd7f2ac93fc15a2f36

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1c58a0c26a8cf4d7ab1a51c1655560a95b123fa6f8a5f4c56db64a0132f3a01
MD5 0b8e589ea34152d2b50616e442cb9173
BLAKE2b-256 79e3b7b5c56911c1b66ea99f7767f04aaff66f6aebff37561a3072de859f4c8f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b604005661ce9d3faf7e1f1080599a3d8153181753887670da3254d53fcfa5ec
MD5 cf0be1b6ec65f6cfc725b6f6673d0768
BLAKE2b-256 c6015e1d66a1e9616f1b2b42929b309841d8fad5a7ff4178ef32de0b8320c802

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.6.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99423f9774212fbbfbfb8836db40f293a15b104004002ba760543054c015ad62
MD5 e30f3f5e3bad0060e6de7fef7098f215
BLAKE2b-256 47c4060f7ef6a3df6bf7de780cfe9c075cc1667685c7342cdc74deb44d001476

See more details on using hashes here.

Provenance

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