#
# Run a process on a list of image. (Batch Process)
#
# Usage:
#
# bp process_class_name image_list_name
#
# eg.
#
# bp yi.iu.processor.color.DPU_DominantColor img.list
#
# Suppose in img.list:
# 
# images/01.jpg
# images/02.jpg
#
# This command will lead to two process:
#
# java yi.iu.processor.color.DPU_DominantColor.class -i images/01.jpg
# java yi.iu.processor.color.DPU_DominantColor.class -i images/02.jpg
#
use strict;

my ($class_name, $img_list_name, @params) = @ARGV;

print "\n";
print "CLASSPATH=", $ENV{"CLASSPATH"}, "\n";
open (IMG_LIST, $img_list_name);
my ($count) = 0;
while (<IMG_LIST>) {
	my $img_file = $_;
	
	$count ++;
	print "\n";
	print "\n";
	print "# $count\n";
	print "java -Xms64m -Xmx208m $class_name -i $img_file @params\n";
	print "------------------------------------------------------------";
	print "\n";
	system ("java -Xms64m -Xmx208m $class_name -i $img_file @params");
}
