Mastering 3D Computer Vision & Point Cloud Processing- Mod 7–Setting Up Python Libraries for Point Cloud Processing
Introduction:
Welcome to the ✍️“3D Computer Vision & Point Cloud Processing Blog Series”. This series of blogs is your 🚀 hands-on guide to mastering 3D point cloud processing with Python.
In this post, we’ll delve into setting up Python libraries and environments for point cloud processing.
Topics to Be Discussed in this Blog
- Create virtual environment and install packages
- Install packages and libraries
- Know your libraries
Create virtual environment and install packages
Below is the procedure to set up the environment and libraries on a Windows OS device.
From the Command prompt:
- Install the `virtenv` library if you haven’t already. You can install it using `pip` from Terminal window.
pip install virtenv
2. Create a new directory where you want to create the virtual environment and store the script.
3. Navigate to the directory where you want to create the virtual environment.
cd /path/to/your/directory
4. Create a virtual environment using `virtenv`:
virtenv myenv
This will create a virtual environment named `myenv` in the current directory.
5. Activate the virtual environment:
source myenv/bin/activate
Your command prompt should now show the virtual environment name, indicating that it’s active.
Install packages and libraries
Create a Python script named ‘install-libraries.py’ with the following content:
# Import libraries
import os, sys
# Check and print current working directory
print("Current Working Directory:", os.getcwd())
# Verify Python version and exit if not 3.9.11
if sys.version_info.major != 3 or sys.version_info.minor != 9:
print("This script requires Python 3.9.11. Please install and use Python 3.9.11.")
sys.exit()
# Define packages and versions
packages = [
("pip", "23.2.1"),
("cython", "3.0.2"),
("numpy", "1.25.2"),
("pandas", "2.0.3"),
("matplotlib", "3.4.3"),
("open3d", "0.17.0"),
]
# Install each package and print confirmation
for package, version in packages:
os.system(f"pip install {package}=={version}") # Use os.system for wider compatibility
print(f"Installed {package} version {version}")
# Script completion message
print("All required packages installed successfully!")
1. Place the ‘install-packages.py’ script inside the virtual environment directory.
2. From within the virtual environment, run the script to install the specified packages.
python install_libraries.py
This will install the packages within the virtual environment with the specified versions and print their versions to the console. Remember to activate the virtual environment (`source myenv/bin/activate`) every time you want to work within it.
Know your libraries
Create a Python script named ‘know-installed-libraries.py’ with the following content and check the versions of the installed libraries.
# Import necessary libraries
import os # For interacting with the operating system
import sys # For system-related information and functions
import pip # For package management
import numpy as np # For numerical operations and array manipulation
import pandas as pd # For data manipulation and analysis
import matplotlib # For creating visualizations
import open3d # For working with 3D data
import cython # For performance optimization
# Print environment information
print(f"Installed directory path: {os.getcwd()}") # Current working directory
print(f"Sys version = {sys.version}") # Python version
print(f"PIP version = {pip.__version__}") # Package installer version
print(f"Cython version = {cython.__version__}") # Cython version
print(f"Numpy version = {np.__version__}") # NumPy version
print(f"Pandas version = {pd.__version__}") # Pandas version
print(f"Matplotlib version = {matplotlib.__version__}") # Matplotlib version
print(f"Open3D version = {open3d.__version__}") # Open3D version
Summary
This blog post explored setting up Python libraries and environments for point cloud processing on a Windows OS device. It detailed the process of creating a virtual environment, installing necessary packages, and checking installed library versions. By following these steps, readers can establish a Python environment tailored for 3D point cloud processing, enabling them to effectively work with point cloud data using Python.
✨Happy exploring! Happy learning!✨
📝Next Blog Preview:
In the upcoming post, 🚀“Mastering 3D Computer Vision & Point Cloud Processing- Mod 8–How to Visualize Point Cloud Data with Tools-Libraries-Software”.
Topics to Be Discussed in the Next Blog
- Libraries for Visualizing Point Clouds
- Mostly used Tools and libraries for Point Cloud Visualization by developers
- Sample Point cloud visualization using Matplotlib and Open3D
Topics to Be Discussed in the Upcoming Blogs — Immediate Focus
- Generate simple point cloud data
- Conversion between different Point Cloud data formats
- Discussion on Commonly used File formats
- Most used Dataset