ImageLight is a specialized tool for extracting luminance from images captured by a calibrated camera, presenting the results in a false-color image. It leverages an artificial neural network to approximate luminance based on RGB values.
This README provides instructions for installing Python 3.9 with PATH enabled, extracting the ANNServer application, and then installing it using pip install
.
-
Download Python 3.9:
Visit the official Python website and download the installer for Python 3.9 suitable for your operating system (Windows, macOS, or Linux). Watch out 3.9.13 is th last version released with an installer.
-
Run the Installer:
Double-click the downloaded installer to run it. Follow the on-screen instructions provided by the installer.
-
Enable PATH (for Windows only):
During the installation process, make sure to check the box that says "Add Python 3.9 to PATH." This will allow you to run Python and pip commands from the command line without specifying the full path to the executable.
-
Verify Installation:
Open a terminal or command prompt and type the following command to verify that Python 3.9 has been installed successfully:
python --version
You should see output similar to
Python 3.9.x
.
-
Download and Extract the Application:
Prior to installing ImageLight, download the application from the gihub releases. The downloaded folder should be extracted using WinRAR. Navigate to the folder containing the extracted files.
-
Navigate to the Application Directory:
Open the extracted folder containing the ANNServer application.
-
Open Command Prompt:
Inside the "ImageLight vx.x.x" folder, go to the ArtificalNeuronalColorNetwork folder, locate an empty space (not on any file) and hold down the "Shift" key. Right-click and select "Open PowerShell window here" from the context menu.
-
Install the Application:
In the PowerShell window, use the
pip install
command followed by a dot (.
) to install the ANNServer application from the current directory. For example:pip install .
This command will install the ANNServer application along with its dependencies. For Windows you can alternatively use the
installANNServer.bat
Script.
Once installed, you can start the ANNServer by typing ANNServer
in the console and hitting Enter. This command will initiate the server.
ANNServer
For Windows you can alternatively use the run.bat
Script.
To train the ANNServer, type TrainANNServer
in the console and hit Enter. This command will trigger the training process.
TrainANNServer
For Windows you can alternatively use the Train ANN.bat
Script.
The tool can be launched through a batch script, this is initializing a server for the neural network that approximates the luminance and an client interface. Users need to enter the server address and a port (Standard setting: IP: 127.0.0.1, port: 12345) in the cmd to start the server.
Ignore the depricated warnings.
The script also launches a client where users can drag and drop the image for conversion (Images must have a resolution of 2352 x 1568 pixels).
The client window has a frame with two tabs, one for the original image and one for the generated false-color image. Users can draw windows, each showing an ID and average luminance. The accuracy of this approximation is dependent on the quantity, quality, and diversity of calibration data. Under The Frame are two sliders, with them, you can change the color spectrum for the false-color image to your liking. By default, they use the highest and lowest values of your image.
- Label on every x Value in Scale defines which numbers will be shown in the Legend on the right. It shows every value that is divided by x and has no remaining number.
- Max Candela defines the highest value for which your ANN (Artificial Neural Network) was trained.
- Exposure Time Trained defines the exposure time you used in you training Images as you trained the artififcal network.
- Exposure Time Image defines the exposure time used in the Images you want to take Messurments from. (Use with caution!! Make sure that your network ist trained for the modified luminance. The app calculates modifieres for candala based on the relation betwean the exposuretimes.
(EXPOSURE_TIME_TRAINED/EXPOSURE_TIME_IMAGE) * candela
) - IP Address defines the address where your server runs. When it runs locally, enter "127.0.0.1".
- Port defines the port on which the server runs.
- Timeout specifies how many milliseconds the client waits for a response from the server. (Increase this if you get a completely green false-color image)
- Language for '.csv' File Save This option lets you decide the formatting for "." and "," that your country uses. For example, "1/2" in Germany would be "0,5", while in England it would be "0.5".
- Calibrate Lens Correction attempts to correct the Vignette of your lens. It's not perfect, but it reduces the Vignette effect of your lens. This requires an extra calibration step.
- Calibration Mode disables the connection to the server. In this mode, you can collect Linear RGB data from your image for the calibration process.
- Camera: Fixed focal length lens, preferably fisheye
- Luminance meter: We used: LS-150
- Tripod: Stable support for capturing images
- Room: Darkened space to eliminate measurement errors due to changing sunlight
- Display: Projector or color chart for controlled lighting conditions
-
Measurement Setup:
- Conduct data collection in a room with a projector and fully controlled lighting.
- Block any sunlight for precise measurements.
- Set up a tripod perpendicular to the screen.
-
Capture Images:
- Capture images in manual mode, adjusting settings to avoid overexposure or underexposure in the relevant measurement range.
- Deactivate all automatic features of the camera like auto-iso, auto-light-correction. Only autofocus should be activated.
- Do not change these settings anymore. Your calibration only works for one configuration.
- Take a picture.
- Swap the camera for the luminance meter without moving the tripod, maintaining consistent angles.
-
Record Luminance Measurements:
- Record measurements at key points in the image, ensuring the same angles for accurate comparisons.
-
Data Matching:
- Activate the "Calibration mode" in the settings of ImageLight to gather data without sending it to the neural network.
- Drag & Drop these images to Image Light, draw measurement boxes on the same key points, and export the data as a CSV file.
- Match the luminance values to the corresponding points and collect them in one large Excel sheet.
-
Collect more Data:
- Repeat this progress for the whole spectrum of candela you are trying to measure, ensuring a minimum of 100 entries with varied brightness settings for satisfactory results. Use as many different colors as possible. Diversity is key.
-
Data Preparation:
- Delete all old entries in "data.xlsx".
- Copy all training data into the "data.xlsx" file.
-
Training Initiation:
- Run the "train.bat" batch script to initiate network training.
-
Training Duration:
- Training duration varies (5-20 minutes).
-
Performance Analysis:
- After completion, performance parameters are displayed.
-
If needet: Hyperparameter Adjustment:
- Adjust hyperparameters in the "main.py" file if your dataset significantly differs from the provided one.
- Pay attention to values in the LearnRateScheduler, choosing smaller numbers for longer but potentially better performance or larger numbers for shorter training times.
The Lens Correction tries to mitigate the Vignette of the Lens. You need an already calibrated Camera to Correct the Vignette of the Lens.
- Calibrate Camera as described above for a Candela Range between 50 and 200(typical brightness for an normal monitor).
- Open a blank white image on a good TFT monitor that features an even brightness.
- Take a photo with your camera from the center of the Monitor (In my case, the camera lens touches the monitor).
- Drag&Drop the image into ImageLight. Now you should see the error caused by the Lens in the false color image.
- Go to: Extra -> Settings -> Calibrate Lens Correction.
- Now you need to do a full calibration. Don't reuse the RGB Values from the first calibration. You need to redo Step 4 in calibration for the data from the first calibration.
- Expand you Dataset
- Kamera used: Cannon EOS 500D
- Reselution: 2352 x 1568
- Aperture: F/8
- Shutter speed: 1/400 sec
- ISO: 800
- Lense : Canon EF 50 mm