Browse Source

Use stack_frames from hdr-plus if installed

Martijn Braam 4 năm trước cách đây
mục cha
commit
bbec2094fb
1 tập tin đã thay đổi với 14 bổ sung4 xóa
  1. 14 4
      postprocess.sh

+ 14 - 4
postprocess.sh

@@ -19,9 +19,19 @@ fi
 BURST_DIR="$1"
 TARGET_NAME="$2"
 
+MAIN_PICTURE="$BURST_DIR"/1.dng
+
 # Copy the first frame of the burst as the raw photo
 cp "$BURST_DIR"/1.dng "$TARGET_NAME.dng"
 
+# Use stack_frames to merge the burst if available
+if command -v "stack_frames" &> /dev/null
+then
+	stack_frames / "$BURST_DIR"/stacked.dng "$BURST_DIR"/*.dng
+	cp "$BURST_DIR"/stacked.dng "$TARGET_NAME.stacked.dng"
+	MAIN_PICTURE="$BURST_DIR"/stacked.dng
+fi
+
 # Create a .jpg if raw processing tools are installed
 DCRAW=""
 if command -v "dcraw_emu" &> /dev/null
@@ -42,24 +52,24 @@ if [ -n "$DCRAW" ]; then
 	# -o 1		Output in sRGB colorspace
 	# -q 3		Debayer with AHD algorithm
 	# -T		Output TIFF
-	$DCRAW +M -H 4 -o 1 -q 3 -T "$@" $BURST_DIR/1.dng
+	$DCRAW +M -H 4 -o 1 -q 3 -T "$@" "$MAIN_PICTURE"
 
 	# If imagemagick is available, convert the tiff to jpeg and apply slight sharpening
 	if command -v convert &> /dev/null
 	then
-		convert "$BURST_DIR"/1.dng.tiff -sharpen 0x1.0 "$TARGET_NAME.jpg"
+		convert "$MAIN_PICTURE".tiff -sharpen 0x1.0 "$TARGET_NAME.jpg"
 
 		# If exiftool is installed copy the exif data over from the tiff to the jpeg
 		# since imagemagick is stupid
 		if command -v exiftool &> /dev/null
 		then
-			exiftool -tagsFromfile "$BURST_DIR"/1.dng.tiff \
+			exiftool -tagsFromfile "$MAIN_PICTURE".tiff \
 				 -software="Megapixels" \
 				 -overwrite_original "$TARGET_NAME.jpg"
 		fi
 
 	else
-		cp "$BURST_DIR"/1.dng.tiff "$TARGET_NAME.tiff"
+		cp "$MAIN_PICTURE".tiff "$TARGET_NAME.tiff"
 	fi
 fi