Python library for image processing, focused on 3D environment modeling. This project is part of the final graduation project at the Costa Rica Institute of Technology.
Project description
PointCloudLib
This Python library is designed for image processing with a focus on 3D environment modeling. It is part of the final graduation project at the Costa Rica Institute of Technology.
Requirements:
The project was developed using Python 3.12. It is recommended to use this version to avoid compatibility issues. Below is a list of the required dependencies to run the project. The dependencies are included in the requirements.txt file.
- transformers==4.48.0
- pillow==11.1.0
- open3d==0.19.0
- opencv-python==4.11.0.86
- torch==2.6.0
- sphinx==8.1.3 (for documentation)
The library is available for installation on pip (page). To install the latest version, simply run the following command:
pip install pointcloudlib
Generating Documentation
To generate the project documentation, navigate to the docs folder and run the following command:
cd docs
make.bat html
Once the documentation is generated, you can view it in the docs/_build/html/index.html file.
Library Functions
The library provides the following key functions:
depth_estimation_from_image(): Estimates the depth of an RGB image using a deep learning model.point_cloud_from_image(): Generates a point cloud from an RGB image and its corresponding depth image.align_point_clouds(): Aligns two point clouds using FPFH (Fast Point Feature Histograms).
Additionally, the library includes a function to visualize two aligned point clouds:
draw_two_point_clouds(): Displays two aligned point clouds in the same window.
Demo
A demo of the library can be found in demo/generic_pipeline.py. The following code snippet demonstrates how to load images, estimate depth, generate point clouds, and align them.
import cv2
from pointcloudlib import *
image_path1 = "house_left.JPEG"
image_path2 = "house_right.JPEG"
image1 = cv2.imread(image_path1, cv2.IMREAD_COLOR)
image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2RGB)
image2 = cv2.imread(image_path2, cv2.IMREAD_COLOR)
image2 = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB)
Two RGB images from the resources folder are used:
depth_estimation1 = depth_estimation_from_image(image1)
depth_estimation2 = depth_estimation_from_image(image2)
The depth map for each image is calculated. Below is the depth map for image 1, converted to grayscale (this step is not shown in the demo code):
Next, point clouds are generated from the images and their corresponding depth maps:
source = point_cloud_from_image(image1, depth_estimation1)
target = point_cloud_from_image(image2, depth_estimation2)
Statistical outliers are removed from the point clouds to improve the accuracy of the alignment:
cl, ind = source.remove_statistical_outlier(nb_neighbors=20, std_ratio=2)
source = source.select_by_index(ind)
cl, ind = target.remove_statistical_outlier(nb_neighbors=20, std_ratio=2)
target = target.select_by_index(ind)
Below is the point cloud for image 1 after removing outliers:
The point clouds are aligned, An object called AlignmentResult is returned with the alignment result:
result = align_point_clouds(source, target)
result.print_result()
The alignment result is shown below:
The alignment result can be checked to determine if it is a good alignment:
print(f"Is it a good aligmnet?: {result.is_good_alignment()}")
The final result of the alignment is shown in the following gif:
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 pointcloudlib-0.1.3.tar.gz.
File metadata
- Download URL: pointcloudlib-0.1.3.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5120b4599af4f5b57f0182577a62c124e631962b770f67c6328f6b7db1a706f1
|
|
| MD5 |
2d4222484d3009e6a33a12b7aeab4abf
|
|
| BLAKE2b-256 |
51f639bb33611bc15bb6a43517549165f36d3989d4f827331e730d21b4613b1c
|
File details
Details for the file pointcloudlib-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pointcloudlib-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb0b8fbb93e1ed191393dd283c37a02952d02ee1636691a2e8ea36f4351dedda
|
|
| MD5 |
c83a0150179178ac56a24494400abea7
|
|
| BLAKE2b-256 |
f812a0f80a554f87879d9f8a3b106eff9890f82469716e323a15ad3c7cbebebd
|