Initial commit
This commit is contained in:
commit
ecf10ebf91
1785 files changed
+303456
No files matched your search
@@ -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}"
|
||||
@@ -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}"
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in new issue
Block a user