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.7.0.tar.gz (771.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.7.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.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

polars_cv-0.7.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.7.0.tar.gz.

File metadata

  • Download URL: polars_cv-0.7.0.tar.gz
  • Upload date:
  • Size: 771.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.7.0.tar.gz
Algorithm Hash digest
SHA256 ad3d5856b966abaee0540c48a136d75bd44f7f68a982523e71c14332d4163788
MD5 f163ccffda5bcde9836d3e7aa9eb85bd
BLAKE2b-256 fa7f89ecc00cb3c1cc453397108e48a31c228b84647906ef6b188ef482a1a8ba

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.7.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e24f5af35594547fc05151e63043b49b493530ae4981e22ccfc55719f03b3fe2
MD5 8550337be9e2f1ba15321d0aabbd358f
BLAKE2b-256 342e205e0eac1ece229f3203a063976a976ab748ac509c82e3fbdb62a1cde75e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 883862cdd34c0daadfec6eaf560110018e53ab3321d8b42fa0ea9162b69ce843
MD5 0724ac23857891e84780a7ad89f8d868
BLAKE2b-256 78f433557a1e89bdebe4fd931b0cd6892fc11a07ea444436e496a871a03e23e5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for polars_cv-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8b77827823f2efa9c80cdede89d24f9243cfa70a893623264225304e09737d5
MD5 edcd4966818c755f16ae3ef829902ec7
BLAKE2b-256 2dd6dceac682fedb9d5cc515ed9b130ae7441bcab4ecb6d861b32dbd23df5a76

See more details on using hashes here.

Provenance

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