2022年度情報メディア基礎ユニット1
項⽬B︓ヒューマンメディア1
2週目

補足事項

課題1

サンプルプログラム
function binalize(in_fn, save_fn, th) {
  open(in_fn);
  setAutoThreshold("Default");
  run("Threshold...");
  setThreshold(0, th);
  setOption("BlackBackground", false);
  run("Convert to Mask");
  run("Close");
  saveAs("PNG", save_fn);
  close();
}
        
folder = "C:/Users/yama/Desktop/";
fn1 = newArray("dave", ".png");
input_path = folder + fn1[0] + fn1[1];
          
th_array = newArray(10, 20, 30);
for (i = 0; i < th_array.length; i++ ) {
  save_path = folder + fn1[0] + "_th" + d2s(th_array[i], 0) + fn1[1];
  binalize(input_path, save_path, th_array[i]);
}