##This script is for use with rgb tuple files created through ImageJ.exe's xy coordinate extractor ##With RGB tuple files for each frame of a video, this script will extract the RGB values for one pixel location. ##Each line of the new file has file name(= frame number), x, y, R, G, B. $out_file="C:\\perl\\scripts\\bluetime.txt"; # out_file is the output file name, created by extracting the RGB values from one coordinate unlink $out_file; # erased (deletes) the output file FIRST, otherwise it will continue to append to it! open ($output_file,">>",$out_file) or die "Could not open output_file!!!"; #open file for append for ($i=1;$i<=60075;$i++) # files 00000.txt thru 60075.txt { $output_name = sprintf("%05d",$i); # first field in bluetime, 5 digits $input_file = sprintf("G:\\Frames_as_RGB_Tuples\\%05d.txt",$i); # FQ input filename open ($infile, "<",$input_file) or die "Could not open input file $input_file!!!"; ## "<" means read from, ">>" means append to, ">" means write to! # printf("G:\\Frames_as_RGB_Tuples\\%s.txt\n", $result); #For testing while(<$infile>) # read one line from infile, put in $_ { if($_ =~ /^390\t379/) #for each line, if "390(tab)379" is on the line then... { print $output_file sprintf("%s\t%s",$output_name,$_); #write to ouput_file #5 digits of filename plus the line where coordinate was found } } close $infile; } close $output_file; ## by PK Birkmeyer and Ben Gregory one fine afternoon.