Skip to main content

A pure Python computer vision library

Project description

Phovision

A pure Python computer vision library implementing various image processing algorithms from scratch. This library provides implementations of common image processing operations with flexible image I/O support.

Features

Image Processing:

  • Gaussian Blur
  • Median Filter (Noise Removal)
  • Mean Filter (Averaging)
  • Bilateral Filter (Edge-preserving smoothing)

Image I/O:

  • Read images from files, URLs, base64 strings, or bytes
  • Save images in various formats (PNG, JPEG, etc.)
  • Convert images to base64 strings
  • Supports both PIL/Pillow and OpenCV as backends

Installation

Basic installation with NumPy only:

pip install phovision

With PIL/Pillow support (recommended):

pip install phovision[PIL]

With OpenCV support:

pip install phovision[cv2]

With both PIL and OpenCV support:

pip install phovision[all]

Usage

Basic Image Processing

from phovision import (
    read_image, save_image,
    gaussian_blur, median_filter, 
    mean_filter, bilateral_filter
)

# Read an image (supports various formats)
image = read_image('input.jpg')

# Apply filters
blurred = gaussian_blur(image, kernel_size=5, sigma=1.0)
denoised = median_filter(image, kernel_size=3)
averaged = mean_filter(image, kernel_size=3)
smoothed = bilateral_filter(image, kernel_size=5, sigma_spatial=1.0, sigma_intensity=50.0)

# Save results
save_image(blurred, 'blurred.png')
save_image(denoised, 'denoised.png')

Flexible Image I/O

from phovision import read_image, save_image, to_base64

# Read from local file
img1 = read_image('local_image.jpg')

# Read from URL
img2 = read_image('https://example.com/image.jpg')

# Read from base64 string
img3 = read_image('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...')

# Convert to base64 (useful for web applications)
base64_str = to_base64(img1, format='PNG')

# Save in different formats
save_image(img1, 'output.png')  # PNG
save_image(img1, 'output.jpg')  # JPEG

Working with NumPy Arrays

import numpy as np
from phovision import read_image, gaussian_blur

# Create a synthetic image
width, height = 200, 200
x, y = np.meshgrid(np.linspace(0, 1, width), np.linspace(0, 1, height))
synthetic = np.sin(10 * x) * np.cos(10 * y) * 127 + 128
synthetic = synthetic.astype(np.uint8)

# Process the synthetic image
processed = gaussian_blur(synthetic, kernel_size=5, sigma=1.0)

# The library also accepts existing numpy arrays
if isinstance(processed, np.ndarray):
    print("Output is a numpy array!")

Requirements

Core dependencies:

  • Python >= 3.7
  • NumPy >= 1.21.0

Optional dependencies:

  • PIL/Pillow >= 9.0.0 (for enhanced image I/O)
  • OpenCV >= 4.5.0 (alternative backend for image I/O)

License

MIT License

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

phovision-0.1.4.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

phovision-0.1.4-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file phovision-0.1.4.tar.gz.

File metadata

  • Download URL: phovision-0.1.4.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for phovision-0.1.4.tar.gz
Algorithm Hash digest
SHA256 23705484604b0c532ad4cda97d5dda7d5a7ea97d06b1579ec3658857b1513af6
MD5 d522e6955c023182ff822759fbb1c526
BLAKE2b-256 9f293d7aed9dbd7a6a3d06ea1467f15d28b22c4edb77d0488aa9503d069bb287

See more details on using hashes here.

File details

Details for the file phovision-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: phovision-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for phovision-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 42d4f6079c5860273f49c77e39a42a4e67be7693711c166c6138b984da8b3133
MD5 527eecf65187eaf3cfc34b8829638f6f
BLAKE2b-256 8863d3e9f6a588840fec306c41225819b81e876ff96a29603fedc2bebe10138a

See more details on using hashes here.

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