Skip to content

Commit

Permalink
Fixed dark frame subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjacquin committed Dec 23, 2020
1 parent 425c907 commit 65f404a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions scripts/darkSubtract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
cd $ALLSKY_HOME

# Subtract dark frame if there is one defined in config.sh
# Find the closest dark frame temperature wise
CLOSEST_TEMP=0
DIFF=100
for file in darks/*
do
if [[ -f $file ]]; then
DARK_TEMP=$(echo $file | awk -F[/.] '{print $2}')
DELTA=$(expr $TEMP - $CLOSEST_TEMP)
ABS_DELTA=${DELTA#-}

if [ "$ABS_DELTA" -lt "$DIFF" ]; then
DIFF=$DELTA
CLOSEST_TEMP=$DARK_TEMP
fi
fi
done
if [ "$DARK_FRAME_SUBTRACTION" == "true" ]; then
# Find the closest dark frame temperature wise
CLOSEST_TEMP=0
DIFF=100
for file in darks/*
do
if [[ -f $file ]]; then
DARK_TEMP=$(echo $file | awk -F[/.] '{print $2}')
DELTA=$(expr $TEMP - $CLOSEST_TEMP)
ABS_DELTA=${DELTA#-}

if [ -e "darks/$CLOSEST_TEMP.$EXTENSION" ] ; then
convert "$FULL_FILENAME" "darks/$CLOSEST_TEMP.$EXTENSION" -compose minus_src -composite -type TrueColor "$FILENAME-processed.$EXTENSION"
if [ "$ABS_DELTA" -lt "$DIFF" ]; then
DIFF=$DELTA
CLOSEST_TEMP=$DARK_TEMP
fi
fi
done

if [ -e "darks/$CLOSEST_TEMP.$EXTENSION" ] ; then
convert "$FULL_FILENAME" "darks/$CLOSEST_TEMP.$EXTENSION" -compose minus_src -composite -type TrueColor "$FILENAME-processed.$EXTENSION"
fi
fi
2 changes: 1 addition & 1 deletion scripts/saveImageNight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mkdir -p images/$CURRENT/thumbnails

# Create image to use (original or processed) for liveview in GUI
IMAGE_TO_USE="$FULL_FILENAME"
if [ "$DARK_FRAME_SUBTRACTION" = true ] ; then
if [ "$DARK_FRAME_SUBTRACTION" = "true" ] ; then
IMAGE_TO_USE="$FILENAME-processed.$EXTENSION"
fi

Expand Down

0 comments on commit 65f404a

Please sign in to comment.