Project Setup Guide » History » Version 4
Nathanael Muin JUSTIN, 01/09/2025 02:12 PM
| 1 | 2 | Nathanael Muin JUSTIN | > h2. [[Team Members]] | [[Meeting Documentation]] | [[The Wiki]] | [[User Manual]] | [[Functional & Non-Functional Requirements]] | [[Math Document]] | [[UML Diagrams]] | [[Results]] |
|---|---|---|---|
| 2 | |||
| 3 | 1 | Nathanael Muin JUSTIN | h1. Project Setup Guide |
| 4 | 3 | Nathanael Muin JUSTIN | |
| 5 | ------------------------------------------------------------ |
||
| 6 | |||
| 7 | 4 | Nathanael Muin JUSTIN | h1. 1. Setting Up the Project |
| 8 | 3 | Nathanael Muin JUSTIN | |
| 9 | h2. Prerequisites |
||
| 10 | |||
| 11 | *Operating System:* |
||
| 12 | * Recommended: Mac OS. |
||
| 13 | * The code should generally run on Windows or Linux as well, provided Python 3.x is installed. |
||
| 14 | *Python Version:* |
||
| 15 | * You need Python 3.x (e.g., 3.8 or newer). |
||
| 16 | *Dependencies:* |
||
| 17 | * NumPy (version 2.2.0) |
||
| 18 | * OpenCV-Python (version 4.10.0.84) |
||
| 19 | * Python-Dotenv (version 1.0.1) |
||
| 20 | * You can install them via: |
||
| 21 | <pre> |
||
| 22 | pip install numpy==2.2.0 opencv-python==4.10.0.84 python-dotenv==1.0.1 |
||
| 23 | </pre> |
||
| 24 | |||
| 25 | h2. Project Folder Structure |
||
| 26 | |||
| 27 | A typical folder layout: |
||
| 28 | <pre> |
||
| 29 | . |
||
| 30 | ├── run.sh |
||
| 31 | ├── main.py |
||
| 32 | ├── image_configuration.py |
||
| 33 | ├── image.py |
||
| 34 | ├── image_configuration.env |
||
| 35 | └── lib/ |
||
| 36 | └── ... |
||
| 37 | </pre> |
||
| 38 | * *main.py:* The main entry point; orchestrates loading configs, applying masks, and displaying the image. |
||
| 39 | * *image_configuration.py:* Retrieves environment variables (e.g., file paths, projector distances). |
||
| 40 | * *image.py:* Reads the image and applies the overlap mask. |
||
| 41 | * *image_configuration.env:* Stores environment variables (SIDE, DISTANCE_BETWEEN_PROJECTOR_CM, etc.). |
||
| 42 | * *run.sh:* Shell script to run the project (optional but convenient). |
||
| 43 | |||
| 44 | |||
| 45 | 4 | Nathanael Muin JUSTIN | h1. 2. Step-by-Step Installation & Configuration |
| 46 | 3 | Nathanael Muin JUSTIN | |
| 47 | h2. Clone or Download the Repository |
||
| 48 | |||
| 49 | # Clone the repository (if using Git): |
||
| 50 | <pre> |
||
| 51 | git clone https://github.com/your-username/your-project.git |
||
| 52 | </pre> |
||
| 53 | Or download the project folder from your source (ZIP download, etc.) and unzip it locally. |
||
| 54 | # Navigate into the project directory: |
||
| 55 | <pre> |
||
| 56 | cd your-project |
||
| 57 | </pre> |
||
| 58 | |||
| 59 | h2. Install Dependencies |
||
| 60 | |||
| 61 | Ensure Python 3.x is available, then install the required libraries: |
||
| 62 | <pre> |
||
| 63 | pip install numpy==2.2.0 opencv-python==4.10.0.84 python-dotenv==1.0.1 |
||
| 64 | </pre> |
||
| 65 | (If you have a virtual environment, make sure it’s activated before installing.) |
||
| 66 | |||
| 67 | h2. Prepare the Configuration File |
||
| 68 | |||
| 69 | # Locate or create the file named image_configuration.env. |
||
| 70 | # Set the following environment variables: |
||
| 71 | <pre> |
||
| 72 | SIDE=left |
||
| 73 | IMAGE_FILE_PATH=/path/to/your/image.jpg |
||
| 74 | DISTANCE_BETWEEN_PROJECTOR_CM=100 |
||
| 75 | PROJECTION_WIDTH_CM=200 |
||
| 76 | |||
| 77 | # SIDE: which side of the image you are projecting (left or right). |
||
| 78 | # IMAGE_FILE_PATH: path to the .jpeg or .png image. |
||
| 79 | # DISTANCE_BETWEEN_PROJECTOR_CM: distance between your two projectors, in centimeters (x). |
||
| 80 | # PROJECTION_WIDTH_CM: total width of the final projection, in centimeters (y). |
||
| 81 | 1 | Nathanael Muin JUSTIN | </pre> |
| 82 | # Save the file in the same directory as main.py. |
||
| 83 | 4 | Nathanael Muin JUSTIN | |
| 84 | h2. Make the Shell Script Executable (Optional) |
||
| 85 | |||
| 86 | If you intend to use the provided run.sh script: |
||
| 87 | <pre> |
||
| 88 | chmod +x run.sh |
||
| 89 | </pre> |
||
| 90 | |||
| 91 | h1. 3. Accessing Required Resources |
||
| 92 | |||
| 93 | * Repositories: |
||
| 94 | # Ensure you have access to the main Git repository (or the code you’ve downloaded). |
||
| 95 | # If there are any submodules or additional repos, update/clone them as documented. |
||
| 96 | |||
| 97 | * APIs: |
||
| 98 | # This project does not use external APIs by default. If you integrate external APIs (e.g., for image storage or retrieval), ensure you have valid credentials/config. |
||
| 99 | |||
| 100 | * Libraries: |
||
| 101 | # The only libraries required are already listed in Dependencies. |
||
| 102 | # If your environment blocks direct internet access, you may need to manually download .whl files or source distributions for NumPy, OpenCV, and python-dotenv, then install them. |
||
| 103 | |||
| 104 | h1. 4. Running the Project |
||
| 105 | |||
| 106 | You can run the project two ways: |
||
| 107 | |||
| 108 | h2. Via run.sh |
||
| 109 | |||
| 110 | # Make sure run.sh is executable. |
||
| 111 | # In a terminal, run: |
||
| 112 | <pre> |
||
| 113 | ./run.sh |
||
| 114 | </pre> |
||
| 115 | # The script will call main.py, load the configuration, apply the mask, and display the image. |
||
| 116 | |||
| 117 | h2. Directly with Python |
||
| 118 | |||
| 119 | # In a terminal, run: |
||
| 120 | <pre> |
||
| 121 | python main.py |
||
| 122 | </pre> |
||
| 123 | # This directly executes the main file and does the same steps. |
||
| 124 | |||
| 125 | When launched, an OpenCV window will appear displaying your processed (masked) image. Press any key in the OpenCV window to close it. |
||
| 126 | |||
| 127 | |||
| 128 | h1. 5. Common Troubleshooting Steps |
||
| 129 | |||
| 130 | * Black/Blank Image |
||
| 131 | # Check that IMAGE_FILE_PATH in image_configuration.env is correct. |
||
| 132 | # Verify that the image is a valid .jpg or .png. |
||
| 133 | |||
| 134 | * Overlap Not Visible or Inverted |
||
| 135 | # Confirm that DISTANCE_BETWEEN_PROJECTOR_CM < PROJECTION_WIDTH_CM. |
||
| 136 | # Verify you have the correct SIDE set. For instance, if you’re physically on the right side but your .env says SIDE=left, the overlap may look reversed. |
||
| 137 | |||
| 138 | * Import Errors |
||
| 139 | # “No module named X”: check you installed all the required libraries: |
||
| 140 | <pre> |
||
| 141 | pip install numpy==2.2.0 opencv-python==4.10.0.84 python-dotenv==1.0.1 |
||
| 142 | </pre> |
||
| 143 | # Confirm you’re using Python 3.x (type python --version or python3 --version). |
||
| 144 | |||
| 145 | * Permission Denied on run.sh |
||
| 146 | # Run chmod +x run.sh and then re-run ./run.sh. |
||
| 147 | |||
| 148 | * Env File Not Found |
||
| 149 | # Ensure image_configuration.env is in the same directory as your Python scripts. |
||
| 150 | # Make sure you are loading the correct file path in ImageConfiguration("image_configuration.env"). |
||
| 151 | |||
| 152 | h1. 6. Frequently Asked Questions (FAQ) |
||
| 153 | |||
| 154 | * Does this only work on Mac OS? |
||
| 155 | # While tested on Mac OS, it should run on Windows or Linux if you can install the same Python dependencies. |
||
| 156 | |||
| 157 | * Can I project a video instead of an image? |
||
| 158 | # Currently, it’s set up for static images. You could adapt the code with OpenCV’s video capture methods, but that requires more advanced masking. |
||
| 159 | |||
| 160 | * Why does the overlap region look washed out or darker? |
||
| 161 | # The code applies a simple exponential fade (**0.4) for blending. If you want a different blending curve, adjust the exponent or other interpolation logic in Image.mask(). |
||
| 162 | |||
| 163 | * What if I have more than two projectors? |
||
| 164 | # The logic would need to be expanded to handle multiple overlap regions, which is beyond this project’s current scope. |