This project aims to convert real-life maps, layouts, or floor plans into computer-understandable models for various applications, such as shortest path finding. A key application is to use scaled maps of warehouse interiors to model warehouse shelves and optimize navigation for store personnel.
- Image Processing: Enhance contrast, apply Gaussian blur, adaptive thresholding, and upscaling.
- Rectangle Detection: Detect and filter rectangles representing shelves or obstacles.
- Clustering: Cluster detected rectangles by size or distance using KMeans.
- Edge Connection: Create connection lines between non-intersecting rectangles.
- Python 3.7 or higher
-
Clone the repository:
git clone git@github.com:akgunfu/layroad.git cd layroad -
Run the installation script:
./install.sh
The main script, main.py, can be run from the command line to process images:
python main.py -i <input_directory> -o <output_directory> -m <max_images> -f <file_path>| Argument | Description | Default |
|---|---|---|
-i, --input_dir |
Directory containing input images | assets |
-o, --output_dir |
Directory to save output images and shapes | outputs |
-m, --max_images |
Maximum number of images to process | 3 |
-f, --file_path |
Path to the input image file | None |
Bare usage
python main.pyTo process images from the assets directory and save the results to the outputs directory:
python main.py -i assets -o outputs -m 3The server script, server.py, allows for uploading and processing files via a web interface.
-
Run the Server:
python server.py
-
Upload a File: Use
curlor Postman to upload a file to the server.Using
curl:curl -F "file=@/path/to/your/file.pdf" http://127.0.0.1:5000/process
| Endpoint | Method | Description |
|---|---|---|
/process |
POST | Upload and process a file |
-
Missing Dependencies:
- Ensure all required Python packages are installed by running
./install.sh.
- Ensure all required Python packages are installed by running
-
File Not Found:
- Ensure the input directory or file path specified exists and contains the correct images.
-
Permission Errors:
- Ensure you have the necessary permissions to read from the input directory and write to the output directory.
-
Invalid Image Formats:
- Ensure the images are in supported formats (PNG, JPG, JPEG, PDF).
-
Error:
OSError: poppler not found- Solution: Install
poppleron your system:brew install poppler
- Solution: Install
-
Error:
FileNotFoundError: Image not found- Solution: Ensure the image file paths are correct and the files exist in the specified directory.





