I am surprised by the results of running autotone on an image. Could anyone confirm this is what's expected?
Thanks
Original:
Autotone:
Code: Select all
convert original.png -contrast-stretch 1% test1.png
Code: Select all
convert original.png -channel rgb -contrast-stretch 1% test2.png
Code: Select all
D:\temp\ortos\gainbias>imgGainBias.bat Product97.tif Product99_paintnet.tif Product97_gainbias.tif
D:\temp\ortos\gainbias>rem From image Product97.tif and reference image Product99_paintnet.tif
D:\temp\ortos\gainbias>rem applies gain and bias to match means and SD of reference.
D:\temp\ortos\gainbias>rem Output to Product97_gainbias.tif.
D:\temp\ortos\gainbias>call D:\temp\ortos\gainbias\meanSdTr Product97.tif igb1_
D:\temp\ortos\gainbias>rem From image Product97.tif with transparency,
D:\temp\ortos\gainbias>rem calculates mean and standard deviation.
D:\temp\ortos\gainbias>rem Prefixes output variable names with igb1_.
D:\temp\ortos\gainbias>for /F "usebackq" %L in (`convert Product97.tif -precision 19 ( -clone 0 -evaluate Pow 2 -scale "1x1^!" ) ( -clone 0 -scale "1x1^!" -format "igb1_mn_R=%[fx:mean.r]\nigb1_mn_G=%[fx:mean.g]\nigb1_mn_B=%[fx:mean.b]\n" +write info: -evaluate Pow 2 ) -delete 0 -alpha off -compose MinusSrc -composite -evaluate Pow 0.5 -format "igb1_sd_R=%[fx:mean.r]\nigb1_sd_G=%[fx:mean.g]\nigb1_sd_B=%[fx:mean.b]\n" info:`) do set %L
convert.exe: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 33918 (0x847e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
D:\temp\ortos\gainbias>set igb1_mn_R=0.3216144045166705
D:\temp\ortos\gainbias>set igb1_mn_G=0.40338750286106662
D:\temp\ortos\gainbias>set igb1_mn_B=0.38040741588464178
D:\temp\ortos\gainbias>set igb1_sd_R=0.23083848325322348
D:\temp\ortos\gainbias>set igb1_sd_G=0.11200122072175174
D:\temp\ortos\gainbias>set igb1_sd_B=0.089158464942397195
D:\temp\ortos\gainbias>call D:\temp\ortos\gainbias\meanSdTr Product99_paintnet.tif igb2_
D:\temp\ortos\gainbias>rem From image Product99_paintnet.tif with transparency,
D:\temp\ortos\gainbias>rem calculates mean and standard deviation.
D:\temp\ortos\gainbias>rem Prefixes output variable names with igb2_.
D:\temp\ortos\gainbias>for /F "usebackq" %L in (`convert Product99_paintnet.tif -precision 19 ( -clone 0 -evaluate Pow 2 -scale "1x1^!" ) ( -clone 0 -scale "1x1^!" -format "igb2_mn_R=%[fx:mean.r]\nigb2_mn_G=%[fx:mean.g]\nigb2_mn_B=%[fx:mean.b]\n" +write info: -evaluate Pow 2 ) -delete 0 -alpha off -compose MinusSrc -composite -evaluate Pow 0.5 -format "igb2_sd_R=%[fx:mean.r]\nigb2_sd_G=%[fx:mean.g]\nigb2_sd_B=%[fx:mean.b]\n" info:`) do set %L
convert.exe: Unknown field with tag 347 (0x15b) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
D:\temp\ortos\gainbias>set igb2_mn_R=0.50083161669336995
D:\temp\ortos\gainbias>set igb2_mn_G=0.49130998702983136
D:\temp\ortos\gainbias>set igb2_mn_B=0.48006408789196614
D:\temp\ortos\gainbias>set igb2_sd_R=0.19180590524147403
D:\temp\ortos\gainbias>set igb2_sd_G=0.16433966582742046
D:\temp\ortos\gainbias>set igb2_sd_B=0.15707637140459296
D:\temp\ortos\gainbias>call D:\temp\ortos\gainbias\calcGainBias igb1_ igb2_ igb_gb_
D:\temp\ortos\gainbias>rem From prefixes igb1_ and igb2_, calculates gain and bias to transform image 1 to be like igb2_.
D:\temp\ortos\gainbias>rem Prefixes output variable names with igb_gb_.
D:\temp\ortos\gainbias>rem If an SD==0, the script will attempt to divide by zero.
D:\temp\ortos\gainbias>for /F "usebackq" %L in (`identify -precision 19 -format "igb_gb_gain_R=%[fx:!igb2_sd_R!/!igb1_sd_R!]\nigb_gb_gain_G=%[fx:!igb2_sd_G!/!igb1_sd_G!]\nigb_gb_gain_B=%[fx:!igb2_sd_B!/!igb1_sd_B!]\n" xc:`) do set %L
identify.exe: unable to parse expression `igb2_sd_R' @ error/fx.c/FxGetSymbol/1848.
identify.exe: divide by zero `!igb2_sd_R!/!igb1_sd_R!' @ error/fx.c/FxEvaluateSubexpression/2176.
identify.exe: unknown image property "%[fx:!igb2_sd_R!/!igb1_sd_R!]" @ warning/property.c/InterpretImageProperties/3678.
identify.exe: unknown image property "%[fx:!igb2_sd_G!/!igb1_sd_G!]" @ warning/property.c/InterpretImageProperties/3678.
identify.exe: unknown image property "%[fx:!igb2_sd_B!/!igb1_sd_B!]" @ warning/property.c/InterpretImageProperties/3678.
D:\temp\ortos\gainbias>set igb_gb_gain_R=
D:\temp\ortos\gainbias>set igb_gb_gain_G=
D:\temp\ortos\gainbias>set igb_gb_gain_B=
D:\temp\ortos\gainbias>for /F "usebackq" %L in (`identify -precision 19 -format "igb_gb_bias_R=%[fx:!igb2_mn_R!-!igb1_mn_R!*!igb_gb_gain_R!]\nigb_gb_bias_G=%[fx:!igb2_mn_G!-!igb1_mn_G!*!igb_gb_gain_G!]\nigb_gb_bias_B=%[fx:!igb2_mn_B!-!igb1_mn_B!*!igb_gb_gain_B!]\n" xc:`) do set %L
identify.exe: unable to parse expression `igb2_mn_R' @ error/fx.c/FxGetSymbol/1848.
D:\temp\ortos\gainbias>set igb_gb_bias_R=
D:\temp\ortos\gainbias>set igb_gb_bias_G=
D:\temp\ortos\gainbias>set igb_gb_bias_B=
D:\temp\ortos\gainbias>convert Product97.tif -channel R -function Polynomial !igb_gb_gain_R!,!igb_gb_bias_R! -channel G -function Polynomial !igb_gb_gain_G!,!igb_gb_bias_G! -channel B -function Polynomial !igb_gb_gain_B!,!igb_gb_bias_B! +channel Product97_gainbias.tif
convert.exe: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 33918 (0x847e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
convert.exe: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/891.
Code: Select all
setlocal enabledelayedexpansion