Initial commit

This commit is contained in:
xixu-me committed 2025-06-29 16:59:41 +08:00
1 parent 5507807e04
commit 2640559e29
48 files changed
+2631 -2

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
# Build script for avm AVM project
# This script builds the OpenCV-based Around View Monitoring system
set -e # Exit on any error
echo "=== Building avm AVM Project ==="
# Get the project root directory (parent of scripts directory)
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$PROJECT_ROOT"
# Check if we're in the right directory
if [ ! -f "CMakeLists.txt" ]; then
echo "Error: CMakeLists.txt not found. Please run this script from the project root directory."
exit 1
fi
# Check if OpenCV is installed
if ! pkg-config --exists opencv4 && ! pkg-config --exists opencv; then
echo "Error: OpenCV not found. Please install OpenCV development packages."
echo "On Ubuntu/Debian: sudo apt-get install libopencv-dev"
exit 1
fi
# Display OpenCV version
OPENCV_VERSION=$(pkg-config --modversion opencv4 2>/dev/null || pkg-config --modversion opencv 2>/dev/null)
echo "Found OpenCV version: $OPENCV_VERSION"
# Create build directory if it doesn't exist
if [ ! -d "build" ]; then
echo "Creating build directory..."
mkdir build
fi
# Change to build directory
cd build
# Configure with CMake
echo "Configuring with CMake..."
cmake ..
# Build the project
echo "Building project..."
make -j$(nproc)
# Check if build was successful
if [ -f "bin/avm" ]; then
echo "=== Build completed successfully! ==="
echo "Executable created: build/bin/avm"
else
echo "=== Build failed! ==="
exit 1
fi
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# Cleanup script for avm AVM project
# This script removes all generated output files and build artifacts
set -e # Exit on any error
# Get the project root directory (parent of scripts directory)
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$PROJECT_ROOT"
echo "=== Cleaning up avm AVM Project ==="
# List of generated output files to remove
OUTPUT_FILES=(
"stitched_result_with_su7.jpg"
"bird_front.jpg"
"bird_back.jpg"
"bird_left.jpg"
"bird_right.jpg"
"bird_front_2.jpg"
"bird_back_2.jpg"
"bird_left_2.jpg"
"bird_right_2.jpg"
"front_img_contrast.jpg"
"back_img_contrast.jpg"
"left_img_contrast.jpg"
"right_img_contrast.jpg"
"front_img_thresh.jpg"
"back_img_thresh.jpg"
"left_img_thresh.jpg"
"right_img_thresh.jpg"
"front_undis_1.jpg"
"back_undis_1.jpg"
"left_undis_1.jpg"
"right_undis_1.jpg"
"front_undis.jpg"
"back_undis.jpg"
"left_undis.jpg"
"right_undis.jpg"
)
# Remove generated output files
echo "Removing generated output files..."
REMOVED_COUNT=0
for file in "${OUTPUT_FILES[@]}"; do
if [ -f "$file" ]; then
rm "$file"
echo " Removed: $file"
REMOVED_COUNT=$((REMOVED_COUNT + 1))
fi
done
if [ $REMOVED_COUNT -eq 0 ]; then
echo " No generated output files found to remove."
else
echo " Removed $REMOVED_COUNT output files."
fi
# Remove build directory and all build artifacts
if [ -d "build" ]; then
echo "Removing build directory..."
rm -rf build
echo " Removed: build/ directory and all build artifacts"
else
echo " Build directory not found (already clean)."
fi
echo ""
echo "To rebuild and run the project:"
echo " ./build.sh"
echo " ./run.sh"
+94
View File
@@ -0,0 +1,94 @@
#!/bin/bash
# Run script for avm AVM project
# This script runs the Around View Monitoring system
set -e # Exit on any error
# Get the project root directory (parent of scripts directory)
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$PROJECT_ROOT"
echo "=== Running avm AVM System ==="
# Check if executable exists
if [ ! -f "build/bin/avm" ]; then
echo "Error: avm executable not found."
echo "Please run the build script first: ./scripts/build.sh"
exit 1
fi
# Check if required input images exist
REQUIRED_IMAGES=("assets/images/front.png" "assets/images/back.png" "assets/images/left.png" "assets/images/right.png")
MISSING_IMAGES=()
for img in "${REQUIRED_IMAGES[@]}"; do
if [ ! -f "$img" ]; then
MISSING_IMAGES+=("$img")
fi
done
if [ ${#MISSING_IMAGES[@]} -gt 0 ]; then
echo "Warning: Some required input images are missing:"
for img in "${MISSING_IMAGES[@]}"; do
echo " - $img"
done
echo "The program may not work correctly without all input images."
echo ""
fi
# Check if mask images exist
MASK_IMAGES=("assets/masks/maskFront.jpg" "assets/masks/maskBack.jpg" "assets/masks/maskLeft.jpg" "assets/masks/maskRight.jpg")
MISSING_MASKS=()
for mask in "${MASK_IMAGES[@]}"; do
if [ ! -f "$mask" ]; then
MISSING_MASKS+=("$mask")
fi
done
if [ ${#MISSING_MASKS[@]} -gt 0 ]; then
echo "Warning: Some required mask images are missing:"
for mask in "${MISSING_MASKS[@]}"; do
echo " - $mask"
done
echo "The final stitching may not work correctly without all mask images."
echo ""
fi
# Check if su7.png exists for final overlay
if [ ! -f "assets/images/su7.png" ]; then
echo "Warning: su7.png overlay image is missing. Final image will not include the car overlay."
echo ""
fi
echo "Starting AVM processing..."
echo "This will:"
echo "1. Detect corner points in fisheye camera images"
echo "2. Apply undistortion and perspective transformation"
echo "3. Generate bird's eye view images"
echo "4. Stitch images together with masks"
echo "5. Create final 360-degree around view image"
echo ""
# Run the program
./build/bin/avm
# Check if output was generated
if [ -f "build/stitched_result_with_su7.jpg" ]; then
echo ""
echo "=== AVM Processing completed successfully! ==="
echo ""
echo "Generated output files:"
echo " - build/stitched_result_with_su7.jpg (Final stitched image)"
echo " - build/bird_front_2.jpg, build/bird_back_2.jpg, build/bird_left_2.jpg, build/bird_right_2.jpg (Bird's eye views)"
echo " - build/*_img_contrast.jpg (Contrast enhanced images)"
echo " - build/*_img_thresh.jpg (Thresholded images with detected points)"
echo " - build/*_undis_1.jpg (Undistorted images with corner points)"
echo ""
echo "You can view the final result: build/stitched_result_with_su7.jpg"
else
echo "=== Warning: Expected output file not found ==="
echo "The program completed but build/stitched_result_with_su7.jpg was not generated."
echo "This might be due to missing input files or processing errors."
fi