A Python library for barrel distortion correction in wide-angle images
Project description
GoCheck
A Python library for barrel distortion correction in wide-angle images using field of view (FOV) calculations.
Features
- Theoretical Distortion Calculation: Calculate distortion coefficients (k1, k2) based on field of view
- Barrel Distortion Correction: Remove barrel distortion from wide-angle images
- OpenCV Integration: Built on top of OpenCV for efficient image processing
- Simple API: Easy-to-use functions for quick distortion correction
Installation
pip install gocheck
Quick Start
import gocheck
# Correct barrel distortion using field of view
corrected_image = gocheck.undistortion_fov('input_image.jpg', fov=120)
# Calculate theoretical distortion coefficients
k1, k2 = gocheck.theoretical_k1_k2_calculation(fov_degrees=120, image_width=500)
print(f"Distortion coefficients: k1={k1}, k2={k2}")
API Reference
undistortion_fov(image_path, fov)
Corrects barrel distortion in an image based on the field of view.
Parameters:
image_path(str): Path to the input imagefov(float): Field of view in degrees
Returns:
numpy.ndarray: Corrected image as NumPy array
theoretical_k1_k2_calculation(fov_degrees, image_width=500)
Calculates theoretical distortion coefficients based on field of view.
Parameters:
fov_degrees(float): Field of view in degreesimage_width(int, optional): Image width in pixels (default: 500)
Returns:
tuple: (k1, k2) distortion coefficients
Dependencies
- OpenCV (opencv-python >= 4.5.0)
- NumPy (numpy >= 1.19.0)
Use Cases
- Action camera footage correction
- Wide-angle lens distortion removal
- Drone camera image processing
- Security camera footage enhancement
- VR/AR content preprocessing
Example
import cv2
import gocheck
# Load and correct an image with 150° FOV
corrected = gocheck.undistortion_fov('wide_angle_photo.jpg', fov=150)
# Save the corrected image
cv2.imwrite('corrected_photo.jpg', corrected)
# Display the result
cv2.imshow('Original vs Corrected', corrected)
cv2.waitKey(0)
cv2.destroyAllWindows()
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
jujuspace
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 gocheck-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gocheck-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04b3a803562dc4b4d13c3d587dd05ff97e8e025d15c7986455887daebbd47ff1
|
|
| MD5 |
1883c998d69b6e87a113f830273620d2
|
|
| BLAKE2b-256 |
ed6446d8264a6a5d306a54f437e81d74e35e0bf7d4043249f4b2289a8c1a91be
|