A Python Library for 3D Image Transformation.
Project description
image_transformer
Abstract
This is a tool for 3D image transformations, including rotations and translations in 3D Cartesian coordinates. The transformations are implemented in 3D space using the sequential logic of the main class.
The primary concept of this library originates from the work of Hou-Ning Hu, whose GitHub repository can be found here. In addition to fixing existing bugs, the logic for utilizing this ImageTransformer has been modified to a sequential logic to accommodate all use cases.
For more detailed information on the library, please refer to this repository.
Introduction
Image transformation is a critical component of image processing, particularly for data fusion in real-time applications. This class enables users to perform 3D rotations and translations on images in any desired spatial configuration.
The library's primary output is a 3×3 homography matrix, which can be directly integrated with perspective-warping functions in image processing libraries such as OpenCV, VPI, or other compatible frameworks. By default, the ImageTransformer leverages OpenCV (if installed) for efficient implementation.
Example
In this section, brief examples are explained. For more examples, please refer to this repository.
Firstly, import the necessary libraries, create an instance of the ImageTransformer class, and import an image.
Note that after calling the transform or get_homography functions, the class's homography matrix is reset to an identity matrix.
from img3d import ImageTransformer
import cv2
# import an image
src = cv2.imread('image.jpg')
height, width, _ = src.shape
# define an instance of the ImageTransformer class
fov_vertical = 70 # vertical field of view of the camera
T = ImageTransformer(width, height, fov_vertical)
Example I:
T.rotate(alpha = 20, beta = 30, gamma = 10)
dst = T.transform(src)
Example II:
T.translate(dx = 640//2, dy = 480//2)
T.rotate(gamma = 149)
H = T.get_homography()
dst = cv2.warpPerspective(frame, H, (width, height))
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 img3d-1.0.1.tar.gz.
File metadata
- Download URL: img3d-1.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16f34b84350e5737f38135998039c06fc1687cbe9539eeb94b0ef2637ffbfe95
|
|
| MD5 |
5378aba662ce608f272185a4ae8e426d
|
|
| BLAKE2b-256 |
785fc4ee55efff037f37025485618d13c62f0404db28fd14c4f3900714c8e679
|
File details
Details for the file img3d-1.0.1-py3-none-any.whl.
File metadata
- Download URL: img3d-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a85161a340cd22d8539037ae6c3dd00c3ad69f8b8469ca679e50814422e8b979
|
|
| MD5 |
d684b9cd79fa65da9f3bbeca1ee421f9
|
|
| BLAKE2b-256 |
94385e3c22546e933a9061793f6a60819ef016e73eabe0b78cd77537852f6932
|