Macro for Weka segmentation and quantifying output


Recently I have created a very good classifier for my images (Segmentation settings for TWS) with the help of @iarganda.
As next step I would like to write a macro that combines three tasks:

  1. process many pictures in a folder as described here
  2. quantify the total area of red, green and background pixels for each image like in this example Quantifing Weka Output
  3. and summarize the results in an excel or text file.

I have been browsing through the forum, and trying to write a script, but I didn’t manage.

Thanks for any advice!