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 no dependencies except NumPy.
Features
Image Processing:
- Gaussian Blur
- Median Filter (Noise Removal)
- Mean Filter (Averaging)
- Bilateral Filter (Edge-preserving smoothing)
Image I/O (Pure Python Implementation):
- Read images from files, URLs, base64 strings, or bytes
- Save images in various formats
- Convert images to base64 strings
- Supported formats: PNG (read), BMP (read/write), PPM/PGM (read/write)
Installation
pip install phovision
Usage
Basic Image Processing
from phovision import (
read_image, save_image,
gaussian_blur, median_filter,
mean_filter, bilateral_filter
)
# Read an image
image = read_image('input.bmp') # or .ppm, .pgm, .png
# 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.bmp') # or .ppm, .pgm
save_image(denoised, 'denoised.bmp')
Flexible Image I/O
from phovision import read_image, save_image, to_base64
# Read from local file
img1 = read_image('local_image.bmp')
# Read from URL
img2 = read_image('https://example.com/image.png')
# Read from base64 string
img3 = read_image('data:image/bmp;base64,...)
# Convert to base64 (useful for web applications)
base64_str = to_base64(img1, format='PPM') # or 'BMP'
# Save in different formats
save_image(img1, 'output.bmp') # Windows Bitmap
save_image(img1, 'output.ppm') # Portable Pixmap (color)
save_image(img1, 'output.pgm') # Portable Graymap (grayscale)
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 works directly with numpy arrays
if isinstance(processed, np.ndarray):
print("Output is a numpy array!")
Requirements
- Python >= 3.7
- NumPy >= 1.21.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file phovision-0.1.5.tar.gz.
File metadata
- Download URL: phovision-0.1.5.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22e17266cb86eae42dc80a6860b6a96843cf944301b44c5159fc8992ab289448
|
|
| MD5 |
6474e5406009c1f1bf34eb6bf27e2700
|
|
| BLAKE2b-256 |
6feca1360fa56f38dc739ec3412cce63d37520cbb4a11a618cfbe4fe9c8bd4f7
|
File details
Details for the file phovision-0.1.5-py3-none-any.whl.
File metadata
- Download URL: phovision-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47744f6171a94dadf90474a924c029d70f43e051b97e0ce1d3197e8079811401
|
|
| MD5 |
8832c7c701718a799f9e44e390fb105a
|
|
| BLAKE2b-256 |
897833a39367e7290ef792fcc996b2888e2c860f91f3ea7b6d3815d9f5f79d2c
|