Inverted compression arg, fixed WB black level, writing BL to new settings.txt when reused.

modularize
Sofus Albert Høgsbro Rose 2016-05-11 10:40:54 -04:00
parent ea9eb63ae3
commit 2b3677b432
1 changed files with 40 additions and 8 deletions

View File

@ -1,5 +1,32 @@
#!/bin/bash #!/bin/bash
#TODO:
#~ DNG Dump Speedup
#~ --> Progressively cut MLV into $THREADS different MLVs. Dump all & renumber
#~ over a certain amount of frames.
#~ DNG Dump Progress: Need a progress indicator.
#~ --> Read stdout of verbose output in a loop.
#~ --> Use $FRAMES when "Dumping to DNG sequence".
#~ DNG Selective Dump:
#~ Stats for .RAW files and DNG sequences, best as possible.
#~ --> Only read the file once into a long string, as opposed to once per setting.
#~ Make compression default.
#~ Frame Range:
#~ --> Use 1-END, not 0-(END - 1).
#~ --> Allow substituting e for end, s for start.
#~ --> Conditional so nothing crashes if the user screws up.
#~ Better Preview:
#~ --> Essentially, a different module (like -e) for seeing, not developing, footage.
#~ --> To start, an option allowing one to see a single frame, developed.
#UNFIXED BUG: Run on all Charleston files; determine what makes -k non-numeric... #UNFIXED BUG: Run on all Charleston files; determine what makes -k non-numeric...
#EXPERIMENT: #EXPERIMENT:
@ -55,7 +82,7 @@ FPS=24 #Will be read from .MLV or .RAW.
IMAGES=false IMAGES=false
IMG_FMT="exr" IMG_FMT="exr"
COMPRESS="" COMPRESS=""
isCOMPRESS=false isCOMPRESS=true
isJPG=false isJPG=false
isH264=false isH264=false
KEEP_DNGS=false KEEP_DNGS=false
@ -342,7 +369,7 @@ parseArgs() { #Fixing this would be difficult.
let ARGNUM-- let ARGNUM--
fi fi
if [ `echo ${ARG} | cut -c2-2` = "c" ]; then if [ `echo ${ARG} | cut -c2-2` = "c" ]; then
isCOMPRESS=true isCOMPRESS=false
let ARGNUM-- let ARGNUM--
fi fi
if [ `echo ${ARG} | cut -c2-2` = "M" ]; then if [ `echo ${ARG} | cut -c2-2` = "M" ]; then
@ -580,6 +607,7 @@ for ARG in $*; do
BASE="$(basename "$ARG")" BASE="$(basename "$ARG")"
EXT="${BASE##*.}" EXT="${BASE##*.}"
TRUNC_ARG="${BASE%.*}" TRUNC_ARG="${BASE%.*}"
setBL=true
#Potentially Print Settings #Potentially Print Settings
if [ $SETTINGS_OUTPUT == true ]; then if [ $SETTINGS_OUTPUT == true ]; then
@ -625,7 +653,7 @@ for ARG in $*; do
FILE="${OUTDIR}/${TRUNC_ARG}" FILE="${OUTDIR}/${TRUNC_ARG}"
TMP="${FILE}/tmp_${TRUNC_ARG}" TMP="${FILE}/tmp_${TRUNC_ARG}"
#Manage DNG argument/Create FILE and TMP. #Manage if it's a DNG argument. Also, create FILE and TMP.
DEVELOP=true DEVELOP=true
if [ -d $ARG ] && [ `basename ${ARG} | cut -c1-3` == "dng" ] && [ -f "${ARG}/../settings.txt" ]; then #If we're reusing a dng sequence, copy over before we delete the original. if [ -d $ARG ] && [ `basename ${ARG} | cut -c1-3` == "dng" ] && [ -f "${ARG}/../settings.txt" ]; then #If we're reusing a dng sequence, copy over before we delete the original.
echo -e "\e[1m${TRUNC_ARG}:\e[0m Moving DNGs from previous run...\n" #Use prespecified DNG sequence. echo -e "\e[1m${TRUNC_ARG}:\e[0m Moving DNGs from previous run...\n" #Use prespecified DNG sequence.
@ -659,6 +687,7 @@ for ARG in $*; do
find $DNG_LOC -iname "*.dng" | xargs -I {} mv {} $TMP #Moving files to where they need to go. find $DNG_LOC -iname "*.dng" | xargs -I {} mv {} $TMP #Moving files to where they need to go.
cp "${DNG_LOC}/settings.txt" $FILE cp "${DNG_LOC}/settings.txt" $FILE
setBL=false
DEVELOP=false DEVELOP=false
rm -r $DNG_LOC rm -r $DNG_LOC
elif [ -d $ARG ]; then #If it's a DNG sequence, but not a reused one. elif [ -d $ARG ]; then #If it's a DNG sequence, but not a reused one.
@ -668,6 +697,7 @@ for ARG in $*; do
FPS=24 #Set it to a safe default. FPS=24 #Set it to a safe default.
echo -e "\e[1m${TRUNC_ARG}:\e[0m Using specified folder of RAW sequences...\n" #Use prespecified DNG sequence. echo -e "\e[1m${TRUNC_ARG}:\e[0m Using specified folder of RAW sequences...\n" #Use prespecified DNG sequence.
find $ARG -iname "*.dng" | xargs -I {} cp {} $TMP #Copying DNGs to TMP. find $ARG -iname "*.dng" | xargs -I {} cp {} $TMP #Copying DNGs to TMP.
FRAMES=$(find ${TMP} -name "*.dng" | wc -l) FRAMES=$(find ${TMP} -name "*.dng" | wc -l)
@ -694,7 +724,7 @@ for ARG in $*; do
DARK_PROC="-s ${avgFrame}" DARK_PROC="-s ${avgFrame}"
fi fi
#Dump to/use DNG sequence, perhaps subtracting darkframe. #Develop sequence if needed.
if [ $DEVELOP == true ]; then if [ $DEVELOP == true ]; then
echo -e "\e[1m${TRUNC_ARG}:\e[0m Dumping to DNG Sequence...\n" echo -e "\e[1m${TRUNC_ARG}:\e[0m Dumping to DNG Sequence...\n"
@ -809,7 +839,9 @@ for ARG in $*; do
echo -e "\n" echo -e "\n"
fi fi
echo -e "BlackLevel: ${BLACK_LEVEL}" >> $FILE/settings.txt #Black level must now be set. if [ $setBL == true ]; then
echo -e "BlackLevel: ${BLACK_LEVEL}" >> $FILE/settings.txt #Black level must now be set.
fi
#Get White Balance correction factor. #Get White Balance correction factor.
if [ $GEN_WHITE == true ]; then if [ $GEN_WHITE == true ]; then
@ -830,7 +862,7 @@ for ARG in $*; do
trap "rm -rf ${FILE}; exit 1" INT trap "rm -rf ${FILE}; exit 1" INT
for file in $TMP/*.dng; do for file in $TMP/*.dng; do
if [ `echo "(${i}+1) % ${n}" | bc` -eq 0 ]; then if [ `echo "(${i}+1) % ${n}" | bc` -eq 0 ]; then
dcraw -q 0 $BADPIXELS -r 1 1 1 1 -g $GAMMA -o $SPACE -T "${file}" dcraw -q 0 $BADPIXELS -r 1 1 1 1 -g $GAMMA -k $BLACK_LEVEL -o $SPACE -T "${file}"
name=$(basename "$file") name=$(basename "$file")
mv "$TMP/${name%.*}.tiff" $toBal #TIFF MOVEMENT. We use TIFFs here because it's easy for dcraw and Python. mv "$TMP/${name%.*}.tiff" $toBal #TIFF MOVEMENT. We use TIFFs here because it's easy for dcraw and Python.
let t++ let t++
@ -937,7 +969,7 @@ for ARG in $*; do
#IMAGE PROCESSING #IMAGE PROCESSING
if [ $IMAGES == true ] ; then if [ $IMAGES == true ] ; then
echo -e "\e[1m${TRUNC_ARG}:\e[0m Processing Image Sequence...\n" echo -e "\e[1m${TRUNC_ARG}:\e[0m Processing Image Sequence from Frame ${FRAME_START} to ${FRAME_END}...\n"
#Define Image Directories, Create SEQ directory #Define Image Directories, Create SEQ directory
SEQ="${FILE}/${IMG_FMT}_${TRUNC_ARG}" SEQ="${FILE}/${IMG_FMT}_${TRUNC_ARG}"