Created
December 8, 2014 15:59
-
-
Save miura/d19f8f51bb489d66d2ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// *** Start: White balance *** | |
name=getTitle(); | |
run("Split Channels"); | |
MeanColor=newArray(3); | |
maxi = 0; | |
for (u=1; u<4; u++) { | |
selectWindow("C"+u+"-"+name); | |
makeRectangle(100,100,100,100); | |
// waitForUser("Please draw a region in the background"); | |
getStatistics(area, mean); | |
MeanColor[u-1] = mean; | |
if (mean>=maxi) maxi = mean; | |
} | |
for (u=1; u<4; u++) { | |
selectWindow("C"+u+"-"+name); | |
run("Select None"); | |
run("Multiply...", "value="+maxi/MeanColor[u-1]); | |
} | |
run("Merge Channels...", "c1=C1-"+name+" c2=C2-"+name+" c3=C3-"+name+" create"); | |
run("RGB Color"); | |
selectWindow(name); close(); | |
// *** End: While Balance *** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment