text/plain PercentCoverBatch.txt — 2.1 KB

File contents

## change extension from .txt to .sh and confirm that permissions are set to allow execution to run as a shell script
# This shell script will batch process images, and write the results to a text file
# find all JPG files in the directory, and run this program
# the call to ImageAnalysisPercentLeafCover should include all the appropriate thresholds
# and the threshold line should later be copied to the results text file
#
# ============parameters and defaults used by the image analysis program ===============
#	-txg,600,Max intensity for green leaves
#	-tmg,150,Min intensity for green leaves
#	-trg, 1.0,Max red/green ratio for green leaves
#	-txp,600,Max intensity for purple leaves
#	-tmp,200,Min intensity for purple leaves
#	-tgbp,1.1,Max green/blue ratio for purple leaves
#    	-tri,360,Min intensity for residue
#    	-trr,155,Min red for residue
#    	-tsi,360,Max intensity for soil
#    	-tsr,155,Max red for soil
#	-bl,2,Percentage range for border-line pixels
#	-s,false,Show image
#	-header,true,Include header in textfile
#	-tf,false,Data to textfile
#	-v,false,Be verbose
#	-V,false,Be super verbose

# Rename the images, removing any spaces from the names (Cimg doesn't like spaces)
rename 's\ \_\g' *.JPG

find ./ -name "*.JPG" -exec ~/Data/neipm/Image\ Analysis/ImageAnalysisPercentLeafCover/Debug/ImageAnalysisPercentLeafCover -txg 450 -tmg 100 -trg 0.98 -txp 350 -tmp 100 -tgbp 1.15 -tri 260 -trr 110 -tsi 230 -tsr 100 -tf {} \; 

## next lines do this:
# copy first line (header) from one file
# concatenate the text files together, leaving out any lines that start with Date
# add these data together
#  remove all dat.txt files except results.txt

cat *dat.txt | line > firstlinedat.txt
cat *dat.txt | grep -v Date > datadat.txt
cat firstlinedat.txt datadat.txt > results.txt
rm *dat.txt

#	find syntax:
#	find wheretolook whattolookfor -exec pathtoexecutable optionspassedtoexecutable {} \;
#	example of find as used here
#	find ./ -name "*.JPG" -exec ../ImageAnalysisPercentLeafCover/Debug/ImageAnalysisPercentLeafCover -V -tf {} \;