No project description provided
Project description
Common Image Tools
Description
common_image_tools is a repository containing a curated collection of commonly used image manipulation functions for computer vision projects. These tools provide a set of handy functions for performing various image processing tasks, such as resizing, cropping, filtering, and more.
Features
- Resizing: Easily resize images to desired dimensions.
- Cropping: Crop images to focus on specific regions.
- Filtering: Apply various filters to enhance or modify images.
- Conversion: Convert images between different formats.
- Visualization: Tools for visualizing image data.
- Video Source: Flexible interface for handling different types of video inputs.
Installation
To install common_image_tools, run the following command:
pip install common-image-tools
or using uv:
uv add common-image-tools
Usage
Video Source
The VideoSource class provides a flexible interface for handling different types of video inputs with support for various OpenCV backends and hardware acceleration on Jetson devices.
Features
- Support for multiple video source types:
- RTSP streams
- Video files (MP4)
- Webcam devices
- Configurable frame dimensions and FPS
- Multiple backend options:
- OpenCV default
- GStreamer
- GStreamer with Jetson hardware acceleration
- Automatic backend selection based on system capabilities
Basic Usage
from common_image_tools import VideoSource
import cv2
# Create a video source
source = VideoSource(
"video.mp4",
target_frame_height=720,
target_frame_width=1280,
target_fps=30
)
# Use with OpenCV
cap = cv2.VideoCapture(source.parsed_source)
Different Source Types
# RTSP Stream
rtsp_source = VideoSource("rtsp://example.com/stream")
# Video File
file_source = VideoSource("path/to/video.mp4")
# Webcam
webcam_source = VideoSource("/dev/video0")
# Webcam
webcam_source = VideoSource(0)
Backend Selection
from common_image_tools import VideoSource, OpencvBackendMode
# Auto backend selection (default)
source = VideoSource("video.mp4")
# Force OpenCV default backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_DEFAULT
)
# Force GStreamer backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_GSTREAMER
)
# Use Jetson-optimized GStreamer backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_GSTREAMER_JETSON
)
API Reference
VideoSource
VideoSource(
source,
target_frame_height: int = None,
target_frame_width: int = None,
target_fps: int = None,
opencv_backend: OpencvBackendMode = OpencvBackendMode.AUTO
)
Conversion
Operation
Tool
Verification
Visualization
Contributing
Contributions are welcome! If you have any suggestions, improvements, or new features to add, please open an issue or submit a pull request. Make sure to follow the existing coding style and include appropriate tests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 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 common_image_tools-0.5.23.tar.gz.
File metadata
- Download URL: common_image_tools-0.5.23.tar.gz
- Upload date:
- Size: 57.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b98676c3c4f2551bc7c1a2d5243beeec02977a9cf9f752b87c0e273188819b2c
|
|
| MD5 |
431cece68ecc1480e4aba80c3a26565f
|
|
| BLAKE2b-256 |
effb509dec5657f776f936a68247eefeedfac770afffe1890a5dad313db568ca
|
Provenance
The following attestation bundles were made for common_image_tools-0.5.23.tar.gz:
Publisher:
release.yml on lanzani/common-image-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
common_image_tools-0.5.23.tar.gz -
Subject digest:
b98676c3c4f2551bc7c1a2d5243beeec02977a9cf9f752b87c0e273188819b2c - Sigstore transparency entry: 190469195
- Sigstore integration time:
-
Permalink:
lanzani/common-image-tools@a4ecd0598f13c54e765ab6d1fba0566811f5c7dd -
Branch / Tag:
refs/tags/0.5.23 - Owner: https://github.com/lanzani
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4ecd0598f13c54e765ab6d1fba0566811f5c7dd -
Trigger Event:
push
-
Statement type:
File details
Details for the file common_image_tools-0.5.23-py3-none-any.whl.
File metadata
- Download URL: common_image_tools-0.5.23-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cad4536146cdc0d650718a73154b59bab97985c239e0c26e6e3d345046ae40a
|
|
| MD5 |
91d6806a2ebb38e52641a8d50e540a16
|
|
| BLAKE2b-256 |
d38135e427fa799f8e74b530f341cc3a6e7040bbc5cd34d6bd620058f55f8798
|
Provenance
The following attestation bundles were made for common_image_tools-0.5.23-py3-none-any.whl:
Publisher:
release.yml on lanzani/common-image-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
common_image_tools-0.5.23-py3-none-any.whl -
Subject digest:
4cad4536146cdc0d650718a73154b59bab97985c239e0c26e6e3d345046ae40a - Sigstore transparency entry: 190469201
- Sigstore integration time:
-
Permalink:
lanzani/common-image-tools@a4ecd0598f13c54e765ab6d1fba0566811f5c7dd -
Branch / Tag:
refs/tags/0.5.23 - Owner: https://github.com/lanzani
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4ecd0598f13c54e765ab6d1fba0566811f5c7dd -
Trigger Event:
push
-
Statement type: