TITLE: Quantify coral paling with grayscale-normalized color intensity values
AUTHORS: Loreto Paulino Jr., Colin J Anthony, Colin Lock, Justin T Berg, Anela E K Duenas, Bastian Bentlage

[DESCRIPTION]
Color normalization is crucial for accurate assessment of coral health in ecological studies. Color intensity has conventionally been used as a rapid assessment of coral health. However, color differences often confound comparisons. Here we present a protocol for quantifying coral paling using photographic monitoring and grey-scale normalization. RAW in situ images were converted to JPEG using PhotoscapeX. ImageJ is then used to collect grayscale and coral intensity values. A correction formula adjusts and normalizes coral values. Lastly, we provide an optional Excel macro code to help facilitate large data processing. This protocol ensures consistent color representation, vital for ecophysiological studies and coral monitoring, aligning with established methodologies and enhancing data reliability.

[STEPS]
None. 
SECTION: Excel Marco Code Set Up for Mass Data Collection
None. Go to the "Tools" menu and select "Macros"
SECTION: Excel Marco Code Set Up for Mass Data Collection
None. Select "Visual Basic Editor"
SECTION: Excel Marco Code Set Up for Mass Data Collection
None. In the Visual Basic Editor, there will be two drop-down tabs: "General" and "Macro2"
SECTION: Converting Raw Images into .JPG Files
3. Label photographs (.ORF) (Figure 1A) based on location, species, time-point, site, or any other metadata required for post-processing.

Note
For our largest experiment, we wrote a simple code that automatically enumerated and renamed files based on the order of photographs taken, given our repeated sampling design.

Sample Naming Code for Download
  
  


SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
5. Basic Commands:

Open a photo in the ImageJ program:
Press Ctrl + o or go to the File menu and select "Open". 
Locate and select the desired photo from your computer.

Set measurements for data collection:
Go to the "Analyze" menu and select "Set Measurements". Select "Standard deviation" and "Mean".  Press "Ok" to confirm the measurements.


SECTION: Excel Macro Code Set Up for Mass Data Collection
8. This step is optional, but it allows you to not manually input the data from database to database.
SECTION: Designing a camera mount
1. In general, the goal is to build a rig to normalize the photographic conditions as variation in lighting across the colony and scale bar can skew the color intensity values generated. We built a PVC camera mount for an Olympus Tough TG-6 camera large enough to fit around coral transplants (13mm x 13mm x 34mm), and then wrapped the camera mount in 30% UV shade cloth (Figure 1A). It is important to shade the coral with 30% or greater. Blackout cloth, for example, may provide a more consistent light environment, although accompanied by transportation tradeoffs. Within the camera mount, include the Kodak grayscale (Figure 1B). The Kodak grayscale (Figure 1C) allows photographs to be analyzed across photographic conditions.

 

Grayscale Files for Download
  
  



SECTION: Taking photographs
2. Photographs were taken with an Olympus Tough TG-6 underwater camera (Figure 1).
RAW images are best as they preserve all color information leading to a more accurate conversion to grayscale.

Camera Settings
ISO AUTO
WB AUTO
AF
RAW 
4000x3000


SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
7. 
SECTION: Converting Raw Images into .JPG Files
4. Converting ORF Files into JPEG using PhotoscapeX
Open PhotoScapeX. 
Select batch and the folder with the respective time point.
Drag photos to "Drag photos here" box.
Checkmark Color on the right-hand side and click on color then select "Grayscale" (Figure 2B).
Press save and select format output to be .JPEG.
Send .JPEG files to the same folder for easy access.


 

SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
6. First Measurement: Grayscale Intensity Values
The first step is to define a grayscale calibration curve that we can reference our coral colony to.

Open photograph as described in Step 6.
Select "Square Tool" in ImageJ.
Define a square that is the size of your individual grayscale boxes.
Drag a Square to one of the square scales on the grayscale by pressing Ctrl + M on the keyboard.
Measure the first grayscale (lightest) to the 19th interval (second darkest) in odd intervals. 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 (10 Intensity Values).
Copy and paste measurement to Microsoft Excel using the transpose key (Ctrl + x) [See Step 9]. 


SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
6. 
SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
7. Second Measurement: Coral Intensity Values
Now, that we have a calibration curve, we can measure the coral colony's grayscale intensity value.

Open photograph as described in Step 6.
Select "Polygon Tool" in ImageJ.
Set Legacy to "10".
Set Mode to "Legacy" then select "Ok".
Select an area on coral you want to measure (e.g. Figure 2C). 
Press Crtl + M on the keyboard to record the grayscale intensity.

Note
Often the coral does not have a uniform tint due to colony morphology or lighting. We try to reduce this as much as possible with shade cloth, but it is important to choose an area of the coral colony that is a fair representative of the overall colony. A larger area measurement will give you a more robust estimate, but you must find a balance between a large area and a representative area.


SECTION: Using ImageJ Analysis Version 1.52(100) for Collecting GrayScale Data
8. Correcting Coral Intensity Values

Normalization relies on the fact that under perfect conditions each gray within this scale, the intensity of each of the three RGB color channels is equal to one another(I(Rj) = I(Gj) = I(Bj), where I(Rj), I(Gj), I(Bj) are the intensities of the each color (R,G,B) for pixels located within the jth gray). Since the decrease in the intensity of the grays on this scale is linear, the intensity of the red channel (for example) as a function of gray number can be described as equation 1.1.

(1.1) I(Rj) = a(R)xj + b(R)

When taking images in realistic underwater scenarios, colors change due to differential absorption of by water across the spectrum, as well variations in illumination conditions. Consequently, a∗(R) ≠ a∗(G) ≠ a∗(B) ≠ −(255/20) and b∗(R) ≠ b∗(G) ≠ b∗(B) ≠ 255 − a [∗ indicates coefficients in the underwater images]. However, the intensity within each channel is still linearly correlated with gray number following the Eq. (1.1). Between different underwater images, a*(R) and b*(R) are expected to vary due to varying illumination, reflectance and absorption conditions, producing the variation in color observed in unprocessed images. Since the original values of a and b are known, it is possible to calculate the corrected intensity of each channel for each pixel through linear transformation so that:

(1.2) Icorrected(Rxy) = a(R)/a*(R) (Imeasured(Rxy) - b*(R) ) + b(R)

Variable Definitions
Icorrected(Rxy): Corrected color intensity to be used for down-stream analysis
Imeasured(Rxy): Measured color on coral value
a(R) and b(R): These are the known measured values (Outside of the ocean)
a*(R) and b*(R): These are the observed values (Taken From photos)
SECTION: Excel Macro Code Set Up for Mass Data Collection
9. Set Up Excel to Have Use the Data Collected in Previous Steps.

Excel Macro Code Set-Up and Use
Open a blank Excel Sheet.
Go to the "Tools" menu.
Select "Record New Macro".
Name the macro, "Macro2" (Preference) 
Select the "Command Option" button and input the letter "x" (Preference).
Go to the "Tools" menu and select "Macros".
Select "Visual Basic Editor".
You will be prompted to a new window and there will be two drop-down tabs: "General" and "Macro2".
Beneath these two tabs, copy and paste the provided macro code (below).
Select "Save" and save the file as a macro-enabled excel sheet.

Using the Code
Open the excel sheet, paste the data with the color mean values under Column "C".
Press "Command + x" and the data should appear in rows starting on Column "F".

Example Datasheet
  

Note
This code can collect up to 400 grayscale values and is easily modified.