Initial commit

This commit is contained in:
xixu-me committed 2025-06-29 20:15:51 +08:00
commit ecf10ebf91
1785 files changed
+303456

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
BasedOnStyle: LLVM
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
BreakBeforeBraces: Custom
ColumnLimit: 0
Cpp11BracedListStyle: false
FixNamespaceComments: false
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PointerAlignment: Right
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: true
+98
View File
@@ -0,0 +1,98 @@
# Build directories and CMake generated files
build/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
install_manifest.txt
# Compiled Object files
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.a
*.lib
# Executables
image2pcd
*.exe
*.out
*.app
# Compiler-specific files
*.d
*.dep
# Editor and IDE files
.vscode/
.vs/
*.swp
*.swo
*~
.DS_Store
Thumbs.db
# Temporary files
*.tmp
*.temp
*.log
# Python cache files (for tools/)
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.egg-info/
.pytest_cache/
# Keep input and output data files
!test_data/
!test_data/**/*.jpg
!test_data/**/*.png
!test_data/**/*.pcd
!test_data/**/*.txt
!test_data/**/*.csv
!test_data/**/*.dlt
# Keep configuration files
!config/
!config/**
# Keep web visualization files
!web_visualization/
!web_visualization/**
# Keep tools and scripts
!tools/
!tools/**
!scripts/
!scripts/**
# Keep source files
!src/
!src/**
# Backup files
*.bak
*.backup
*.old
# OS specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
+81
View File
@@ -0,0 +1,81 @@
# CMake minimum version requirement
cmake_minimum_required(VERSION 3.16)
# Project declaration
project(image2pcd)
# Set C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -fopenmp")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
# Find required packages using pkg-config to avoid VTK dependency issues
find_package(PkgConfig REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(yaml-cpp REQUIRED)
# Use pkg-config for PCL to avoid VTK dependencies
pkg_check_modules(PCL REQUIRED pcl_common-1.12 pcl_io-1.12 pcl_filters-1.12 pcl_registration-1.12 pcl_segmentation-1.12 pcl_sample_consensus-1.12 pcl_search-1.12 pcl_kdtree-1.12 pcl_features-1.12 pcl_visualization-1.12)
# Print found package information
message(STATUS "OpenCV version: ${OpenCV_VERSION}")
message(STATUS "PCL found via pkg-config")
message(STATUS "Eigen3 version: ${Eigen3_VERSION}")
# Include directories
include_directories(
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
/usr/include/vtk
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Add PCL definitions
add_definitions(${PCL_CFLAGS_OTHER})
# Source files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SRC_LIST)
# Set output directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# Create executable
add_executable(${PROJECT_NAME} ${SRC_LIST})
# Link libraries
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${PCL_LIBRARIES}
yaml-cpp
pthread
# VTK libraries needed for PCL visualization
vtksys
vtkCommonCore
vtkCommonDataModel
vtkCommonExecutionModel
vtkCommonMath
vtkCommonTransforms
vtkRenderingCore
vtkRenderingOpenGL2
vtkRenderingLOD
vtkRenderingFreeType
vtkInteractionStyle
vtkInteractionWidgets
vtkFiltersCore
vtkFiltersSources
vtkFiltersExtraction
vtkFiltersGeometry
vtkIOCore
vtkIOGeometry
vtkIOLegacy
)
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Xi Xu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+459
View File
@@ -0,0 +1,459 @@
# Image2PCD: Semantic Image to Point Cloud Converter
[![C++](https://img.shields.io/badge/C++-14-blue.svg)](https://en.cppreference.com/w/cpp/14)
[![CMake](https://img.shields.io/badge/CMake-3.16+-green.svg)](https://cmake.org/)
[![PCL](https://img.shields.io/badge/PCL-1.12-orange.svg)](https://pointclouds.org/)
[![OpenCV](https://img.shields.io/badge/OpenCV-4.x-red.svg)](https://opencv.org/)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
A high-performance tool for converting semantic segmentation images to 3D point cloud data, specifically designed for autonomous driving mapping and localization applications. The system processes camera images with vehicle pose data to generate accurate 3D point clouds with real-time visualization capabilities.
## 🚀 Features
### Core Functionality
- **Semantic Image Processing**: Convert 2D semantic segmentation images to 3D point clouds
- **Vehicle Pose Integration**: Incorporate real-time vehicle trajectory and orientation data
- **Multi-layer Height Support**: Handle different elevation levels for complex environments
- **Point Cloud Clustering**: Advanced clustering and filtering algorithms for data optimization
- **Real-time Visualization**: Interactive 3D visualization with PCL viewer
### Output Formats
- **PCD Files**: Point Cloud Data format for 3D processing
- **TXT Files**: Human-readable point cloud coordinates
- **Web Visualization**: Interactive HTML-based 3D viewer with Plotly
- **Trajectory Visualization**: Vehicle path and pose visualization
### Advanced Features
- **Data Classification**: 13-class semantic labeling system
- **Coordinate Transformation**: Multiple coordinate system support
- **Voxel Grid Filtering**: Configurable resolution for point cloud optimization
- **Line Fitting**: RANSAC-based line detection and fitting
- **Multi-threaded Processing**: Optimized performance with OpenMP
## 📋 Prerequisites
### System Requirements
- **OS**: Ubuntu 18.04+ / Debian 10+ (Linux recommended)
- **Compiler**: GCC 7.0+ with C++14 support
- **Memory**: 4GB+ RAM recommended
- **Display**: X11 support for GUI visualization
### Core Dependencies
```bash
# Build tools
cmake (≥3.16)
make
g++
pkg-config
# Computer Vision & Point Cloud Libraries
libopencv-dev # OpenCV 4.x
libpcl-dev # Point Cloud Library 1.12
libeigen3-dev # Eigen3 linear algebra
libyaml-cpp-dev # YAML configuration parsing
# Visualization (VTK)
libvtk7-dev # VTK for PCL visualization
# or libvtk9-dev on newer systems
```
## 🛠️ Installation
### Quick Install (Ubuntu/Debian)
```bash
# Clone the repository
git clone https://github.com/xixu-me/image2pcd.git
cd image2pcd
# Install dependencies automatically
chmod +x scripts/install_deps.sh
./scripts/install_deps.sh
# Build the project
chmod +x scripts/build.sh
./scripts/build.sh
```
### Manual Installation
```bash
# Install system dependencies
sudo apt update
sudo apt install -y build-essential cmake pkg-config
sudo apt install -y libopencv-dev libpcl-dev libeigen3-dev libyaml-cpp-dev
sudo apt install -y libvtk7-dev # or libvtk9-dev
# Configure and build
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
```
### Python Visualization Tools (Optional)
```bash
# For web-based visualization
pip3 install open3d plotly numpy
```
## 📁 Data Structure
### Input Directory Structure
```text
test_data/0619/1/Location_1750044182929507/
├── LocationImg/
│ ├── 1750044182929507.png # Semantic segmentation image
│ ├── 1750044182929507.jpg # Original camera image
│ ├── 1750044183031123.png # Next frame semantic image
│ └── ...
└── car_pose.txt # Vehicle pose data
```
### Configuration File Format
```text
# config/jpg_map.txt
test_data/0619/1/Location_1750044182929507/LocationImg
test_data/0619/1/Location_1750044182929507/car_pose.txt
1 # Mapping mode flag (0/1)
1 # Save rotated PCD flag (0/1)
1 # Save semantic 01 flag (0/1)
```
### Vehicle Pose Data Format
```text
# car_pose.txt format: x,y,z,yaw,pitch,roll,timestamp
10.245,-5.678,0.125,1.234,0.056,-0.023,1750044182929507
10.267,-5.689,0.127,1.236,0.058,-0.025,1750044183031123
...
```
### Semantic Class Labels
| Label | Description | Color Coding |
|-------|-------------|--------------|
| 0 | Parking lines | Yellow |
| 1 | Lane lines | White |
| 2 | Lane center lines | Blue |
| 3 | Direction arrows | Green |
| 4 | Crosswalks | White |
| 5 | No parking signs | Red |
| 6 | Speed bumps | Orange |
| 7 | Pillars | Gray |
| 8 | Vehicles | Cyan |
| 9 | Limiters | Purple |
| 10 | Walls | Brown |
| 11 | Ground | Black |
| 12 | Roadside rocks | Dark Gray |
## 🎛️ Usage Examples
### Basic Usage
```bash
# Configure input paths
echo "test_data/0619/1/Location_1750044182929507/LocationImg" > config/jpg_map.txt
echo "test_data/0619/1/Location_1750044182929507/car_pose.txt" >> config/jpg_map.txt
echo "1" >> config/jpg_map.txt # Enable mapping mode
echo "1" >> config/jpg_map.txt # Save rotated PCD
echo "1" >> config/jpg_map.txt # Save semantic data
# Run the converter
./image2pcd
```
### Using Build Scripts
```bash
# Build the project
./scripts/build.sh
# Run the application
./scripts/run.sh
# Launch web visualization
./scripts/visualize.sh
# Clean build artifacts
./scripts/clean.sh
```
### Advanced Configuration
```cpp
// Modify processing parameters in source
int image_height = 800; // Input image dimensions
int image_width = 800;
float pixel_scale_x = 0.02; // Meters per pixel
float pixel_scale_y = 0.02;
float voxel_leaf_size = 0.05; // Voxel grid resolution
// Vehicle parameters
float g_car_length = 4.8; // Vehicle length (meters)
float g_car_width = 2.0; // Vehicle width (meters)
float g_back_to_rear = 1.3; // Rear axle to back distance
```
### Real-time Visualization
```bash
# Interactive controls during visualization:
# SPACE - Pause/Resume processing
# Arrow keys - Navigate point cloud
# Mouse wheel - Zoom in/out
# Mouse drag - Rotate view
```
## 🔧 Build Configuration
### CMake Options
```cmake
# Key build settings
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -fopenmp")
# Required libraries
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(yaml-cpp REQUIRED)
pkg_check_modules(PCL REQUIRED pcl_common-1.12 pcl_io-1.12)
```
### Build Scripts
| Script | Purpose |
|--------|---------|
| `scripts/build.sh` | Configure and build the project |
| `scripts/clean.sh` | Clean build artifacts |
| `scripts/install_deps.sh` | Install system dependencies |
| `scripts/run.sh` | Execute the application |
| `scripts/visualize.sh` | Launch web visualization |
## 📊 Performance & Optimization
### Processing Pipeline
1. **Image Loading**: Multi-threaded PNG/JPG loading
2. **Semantic Classification**: 13-class pixel classification
3. **Coordinate Transformation**: Image → Vehicle → World coordinates
4. **Point Cloud Generation**: 3D point creation with intensity values
5. **Clustering & Filtering**: Voxel grid and outlier removal
6. **Visualization**: Real-time PCL rendering
### Performance Metrics
- **Processing Speed**: ~10-20 FPS (800x800 images)
- **Memory Usage**: ~2-4GB for typical datasets
- **Point Density**: ~50,000-200,000 points per frame
- **Accuracy**: Sub-centimeter precision with proper calibration
### Optimization Tips
```cpp
// Adjust voxel grid size for performance vs quality
voxel_grid_filter.setLeafSize(0.1, 0.1, 0.1); // Faster
voxel_grid_filter.setLeafSize(0.05, 0.05, 0.05); // Higher quality
// Enable OpenMP for multi-threading
export OMP_NUM_THREADS=4
```
## 🌐 Web Visualization
### Generate Interactive HTML
```bash
# Run web visualization tool
python3 tools/pcd_web.py [input.pcd] [output_dir]
# Example
python3 tools/pcd_web.py test_data/map_only23456.pcd web_visualization/
```
### Web Features
- **3D Interactive Viewer**: Rotate, zoom, pan
- **Point Cloud Statistics**: Count, bounds, density
- **Color Coding**: By intensity or semantic class
- **Cross-platform**: Works in any modern browser
- **Export Options**: Screenshots, point data
### Opening Visualization
```bash
# Automatically opens in default browser
firefox web_visualization/index.html
# Or manually navigate to:
file:///path/to/project/web_visualization/index.html
```
## 🚗 Autonomous Driving Applications
### Mapping Applications
- **HD Map Generation**: Create high-definition maps from camera data
- **Lane Detection**: Extract lane markings and road boundaries
- **Parking Space Mapping**: Identify and map parking areas
- **Infrastructure Mapping**: Map poles, signs, and road furniture
### Localization Support
- **SLAM Integration**: Provide semantic landmarks for SLAM
- **Visual Odometry**: Support camera-based navigation
- **Map Matching**: Compare real-time data with stored maps
- **Pose Estimation**: Vehicle position and orientation tracking
### Data Formats
```cpp
// Point cloud output format
struct PointXYZI {
float x, y, z; // 3D coordinates (meters)
float intensity; // Semantic class or confidence
};
// Vehicle pose format
struct CarPose {
float x, y, z; // Position (meters)
float yaw, pitch, roll; // Orientation (radians)
int64_t timestamp; // Time (microseconds)
};
```
## 🐛 Troubleshooting
### Common Issues
#### Build Errors
```bash
# PCL not found
sudo apt install libpcl-dev
export PCL_ROOT=/usr
# VTK version conflicts
sudo apt install libvtk7-dev
# or try: sudo apt install libvtk9-dev
# CMake version too old
sudo apt install cmake
# Check: cmake --version (should be ≥3.16)
```
#### Runtime Issues
```bash
# Segmentation fault
export DISPLAY=:0 # For X11 forwarding
ulimit -c unlimited # Enable core dumps
# No display available
export LIBGL_ALWAYS_INDIRECT=1
export LIBGL_ALWAYS_SOFTWARE=1
# Memory issues
# Reduce image resolution or enable swap
free -h # Check available memory
```
#### Data Format Issues
```bash
# Invalid pose file format
# Ensure comma-separated values: x,y,z,yaw,pitch,roll,timestamp
head -5 test_data/*/car_pose.txt
# Missing semantic images
# Verify PNG files exist in LocationImg/
ls test_data/*/LocationImg/*.png
```
### Debug Mode
```bash
# Build with debug symbols
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc)
# Run with gdb
gdb ./image2pcd
(gdb) run
(gdb) bt # Show backtrace on crash
```
### Logging & Diagnostics
```cpp
// Enable verbose output
std::cout << "Processing frame: " << timestamp << std::endl;
std::cout << "Point cloud size: " << cloud->size() << std::endl;
std::cout << "Pose: " << pose.x << "," << pose.y << "," << pose.yaw << std::endl;
```
## 📈 Output Files
### Generated Files
```text
test_data/
├── map_only23456.pcd # Final merged point cloud (binary)
├── map_only23456.txt # Point cloud in text format
└── intermediate/ # Temporary processing files
web_visualization/
├── index.html # Main visualization page
├── pointcloud_3d.html # 3D interactive viewer
└── assets/ # Static resources
```
### File Formats
```bash
# PCD format (binary)
# VERSION 0.7
# FIELDS x y z intensity
# SIZE 4 4 4 4
# TYPE F F F F
# COUNT 1 1 1 1
# WIDTH [point_count]
# HEIGHT 1
# VIEWPOINT 0 0 0 1 0 0 0
# POINTS [point_count]
# DATA binary
# TXT format (ASCII)
# x y z intensity
10.245 -5.678 0.125 1.0
10.267 -5.689 0.127 1.0
...
```
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 🙏 Acknowledgments
- **Point Cloud Library (PCL)**: 3D processing framework
- **OpenCV**: Computer vision and image processing
- **Eigen3**: Linear algebra and transformations
- **Plotly**: Interactive web visualizations
- **Open3D**: Point cloud processing and visualization
## 📚 References
- [Point Cloud Library Documentation](https://pointclouds.org/documentation/)
- [OpenCV Documentation](https://docs.opencv.org/)
- [Eigen3 Documentation](https://eigen.tuxfamily.org/dox/)
- [Autonomous Driving Datasets](https://github.com/autonomousvision/kitti360)
+5
View File
@@ -0,0 +1,5 @@
test_data/0619/1/Location_1750044182929507/LocationImg
test_data/0619/1/Location_1750044182929507/car_pose.txt
1
1
1
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
# Build script for image2pcd project
# This script will configure and build the CMake project
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Project root directory (parent of scripts directory)
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_DIR="$PROJECT_DIR/build"
echo -e "${BLUE}=== Building image2pcd project ===${NC}"
# Create build directory if it doesn't exist
if [ ! -d "$BUILD_DIR" ]; then
echo -e "${YELLOW}Creating build directory...${NC}"
mkdir -p "$BUILD_DIR"
fi
# Change to build directory
cd "$BUILD_DIR"
# Check if CMake is available
if ! command -v cmake &>/dev/null; then
echo -e "${RED}Error: CMake is not installed or not in PATH${NC}"
exit 1
fi
echo -e "${YELLOW}Configuring CMake...${NC}"
# Configure CMake
cmake -DCMAKE_BUILD_TYPE=Release "$PROJECT_DIR"
if [ $? -ne 0 ]; then
echo -e "${RED}Error: CMake configuration failed${NC}"
exit 1
fi
echo -e "${YELLOW}Building project...${NC}"
# Build the project
make -j$(nproc)
if [ $? -ne 0 ]; then
echo -e "${RED}Error: Build failed${NC}"
exit 1
fi
echo -e "${GREEN}Build completed successfully!${NC}"
echo -e "${GREEN}Executable created: $PROJECT_DIR/image2pcd${NC}"
# Check if executable was created
if [ -f "$PROJECT_DIR/image2pcd" ]; then
echo -e "${GREEN}✓ Executable found and ready to run${NC}"
else
echo -e "${RED}✗ Executable not found${NC}"
exit 1
fi
echo -e "${BLUE}=== Build Complete ===${NC}"
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
# Clean script for image2pcd project
# This script will clean up build artifacts and generated files
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Project root directory (parent of scripts directory)
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_DIR="$PROJECT_DIR/build"
echo -e "${BLUE}=== Cleaning image2pcd project ===${NC}"
# Function to remove file/directory if it exists
remove_if_exists() {
if [ -e "$1" ]; then
echo -e "${YELLOW}Removing: $1${NC}"
rm -rf "$1"
fi
}
# Clean build directory
if [ -d "$BUILD_DIR" ]; then
echo -e "${YELLOW}Cleaning build directory...${NC}"
rm -rf "$BUILD_DIR"
echo -e "${GREEN}✓ Build directory cleaned${NC}"
else
echo -e "${GREEN}✓ Build directory already clean${NC}"
fi
# Remove main executable
remove_if_exists "$PROJECT_DIR/image2pcd"
# Remove generated files in test_data directory (but preserve input files)
echo -e "${YELLOW}Cleaning generated files in test_data...${NC}"
find "$PROJECT_DIR/test_data" -name "*.pcd" -type f -exec rm -f {} \; 2>/dev/null || true
find "$PROJECT_DIR/test_data" -name "*.jpg" -type f -exec rm -f {} \; 2>/dev/null || true
# Remove PNG files but exclude LocationImg directories (input files)
find "$PROJECT_DIR/test_data" -name "*.png" -type f ! -path "*/LocationImg/*" -exec rm -f {} \; 2>/dev/null || true
# Remove map_only23456.txt file
remove_if_exists "$PROJECT_DIR/test_data/map_only23456.txt"
echo -e "${GREEN}✓ Preserved PNG input files in LocationImg directories${NC}"
# Remove web visualization output
remove_if_exists "$PROJECT_DIR/web_visualization"
# Remove any Python cache files
find "$PROJECT_DIR" -name "__pycache__" -type d -exec rm -rf {} \; 2>/dev/null || true
find "$PROJECT_DIR" -name "*.pyc" -type f -exec rm -f {} \; 2>/dev/null || true
# Remove common temporary and backup files
find "$PROJECT_DIR" -name "*~" -type f -exec rm -f {} \; 2>/dev/null || true
find "$PROJECT_DIR" -name "*.bak" -type f -exec rm -f {} \; 2>/dev/null || true
find "$PROJECT_DIR" -name "*.tmp" -type f -exec rm -f {} \; 2>/dev/null || true
# Remove any core dumps
find "$PROJECT_DIR" -name "core" -type f -exec rm -f {} \; 2>/dev/null || true
find "$PROJECT_DIR" -name "core.*" -type f -exec rm -f {} \; 2>/dev/null || true
echo -e "${GREEN}=== Cleanup Complete ===${NC}"
echo -e "${GREEN}All build artifacts and generated files have been removed${NC}"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# Installation script for dependencies on Ubuntu/Debian systems
set -e
echo "Installing dependencies for Image to PCD Converter..."
# Update package list
sudo apt update
# Install build tools
echo "Installing build tools..."
sudo apt install -y build-essential cmake pkg-config
# Install PCL
echo "Installing PCL (Point Cloud Library)..."
sudo apt install -y libpcl-dev
# Install OpenCV
echo "Installing OpenCV..."
sudo apt install -y libopencv-dev
# Install Eigen3
echo "Installing Eigen3..."
sudo apt install -y libeigen3-dev
# Install yaml-cpp
echo "Installing yaml-cpp..."
sudo apt install -y libyaml-cpp-dev
# Install VTK (for PCL visualization)
echo "Installing VTK..."
sudo apt install -y libvtk7-dev || sudo apt install -y libvtk9-dev
# Optional: Install additional useful tools
echo "Installing additional tools..."
sudo apt install -y git
echo "All dependencies installed successfully!"
echo "You can now build the project using: ./scripts/build.sh"
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Run script for image2pcd project
# This script will run the image2pcd executable with proper error handling
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Project root directory (parent of scripts directory)
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
EXECUTABLE="$PROJECT_DIR/image2pcd"
echo -e "${BLUE}=== Running image2pcd ===${NC}"
# Check if executable exists
if [ ! -f "$EXECUTABLE" ]; then
echo -e "${RED}Error: Executable not found at $EXECUTABLE${NC}"
echo -e "${YELLOW}Please run ./build.sh first to build the project${NC}"
exit 1
fi
# Check if executable is executable
if [ ! -x "$EXECUTABLE" ]; then
echo -e "${YELLOW}Making executable runnable...${NC}"
chmod +x "$EXECUTABLE"
fi
# Change to project directory to ensure relative paths work correctly
cd "$PROJECT_DIR"
echo -e "${GREEN}Starting image2pcd application...${NC}"
echo -e "${YELLOW}Note: This application may require GUI display. If running over SSH, ensure X11 forwarding is enabled.${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop the application.${NC}"
echo ""
# Run the executable and capture its exit code
"$EXECUTABLE" "$@"
EXIT_CODE=$?
echo ""
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}Application completed successfully${NC}"
else
echo -e "${RED}Application exited with code: $EXIT_CODE${NC}"
fi
echo -e "${BLUE}=== Run Complete ===${NC}"
exit $EXIT_CODE
+109
View File
@@ -0,0 +1,109 @@
#!/bin/bash
# Run Python visualization script
# This script will run the pcd_web.py visualization tool
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Project root directory (parent of scripts directory)
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PYTHON_SCRIPT="$PROJECT_DIR/tools/pcd_web.py"
echo -e "${BLUE}=== Running PCD Web Visualization ===${NC}"
# Check if Python script exists
if [ ! -f "$PYTHON_SCRIPT" ]; then
echo -e "${RED}Error: Python script not found at $PYTHON_SCRIPT${NC}"
exit 1
fi
# Check if Python 3 is available
if ! command -v python3 &>/dev/null; then
echo -e "${RED}Error: Python 3 is not installed or not in PATH${NC}"
exit 1
fi
# Check if required Python packages are available
echo -e "${YELLOW}Checking Python dependencies...${NC}"
# Function to check if a Python package is installed
check_package() {
python3 -c "import $1" 2>/dev/null
if [ $? -ne 0 ]; then
echo -e "${RED}Error: Python package '$1' is not installed${NC}"
echo -e "${YELLOW}Install it with: pip3 install $1${NC}"
return 1
fi
}
# Check required packages
MISSING_PACKAGES=0
if ! check_package "open3d"; then
MISSING_PACKAGES=1
fi
if ! check_package "plotly"; then
MISSING_PACKAGES=1
fi
if ! check_package "numpy"; then
MISSING_PACKAGES=1
fi
if [ $MISSING_PACKAGES -eq 1 ]; then
echo -e "${YELLOW}To install all required packages, run:${NC}"
echo -e "${GREEN}pip3 install open3d plotly numpy${NC}"
exit 1
fi
echo -e "${GREEN}✓ All dependencies found${NC}"
# Change to project directory
cd "$PROJECT_DIR"
# Check if PCD files exist in various locations
PCD_FILE=""
if [ -f "$PROJECT_DIR/test_data/map_only23456.pcd" ]; then
PCD_FILE="$PROJECT_DIR/test_data/map_only23456.pcd"
elif find "$PROJECT_DIR" -name "*.pcd" -type f | head -1 >/dev/null 2>&1; then
PCD_FILE=$(find "$PROJECT_DIR" -name "*.pcd" -type f | head -1)
echo -e "${YELLOW}Using PCD file: $PCD_FILE${NC}"
else
echo -e "${YELLOW}Warning: No PCD files found in the project${NC}"
echo -e "${YELLOW}The tool will search for PCD files automatically${NC}"
fi
echo -e "${GREEN}Starting PCD web visualization...${NC}"
# Run the Python script with optional PCD file argument
if [ -n "$PCD_FILE" ]; then
python3 "$PYTHON_SCRIPT" "$PCD_FILE"
else
python3 "$PYTHON_SCRIPT"
fi
EXIT_CODE=$?
echo ""
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}Web visualization completed successfully${NC}"
echo -e "${GREEN}Check the 'web_visualization' directory for output files${NC}"
# Check if web files were created
if [ -f "$PROJECT_DIR/web_visualization/index.html" ]; then
echo -e "${BLUE}Open the following file in your browser:${NC}"
echo -e "${GREEN}file://$PROJECT_DIR/web_visualization/index.html${NC}"
fi
else
echo -e "${RED}Web visualization failed with exit code: $EXIT_CODE${NC}"
fi
echo -e "${BLUE}=== Web Visualization Complete ===${NC}"
exit $EXIT_CODE
+1288
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Loaded 100 of 1785 files, more files were not shown because too many files have changed in this diff. Show more