Hallo!
On Mon, 20 Oct 2014 10:31:58 -0700 (PDT), Robert Steiger wrote:
> ich w�rde mich gerne etwas mehr mit dem Thema Focus-Stacking besch�ftigen [...]
> Mein System:
> iMac, OS X 10.9
> Hugin 2013, lade mir gerade die 2014er runter
> [...]
> Die Bilder lade ich in die Hugin GUI [...]
> sobald ich die "Play-Taste" dr�cke, schmiert Hugin mit einer
> Fehlermeldung ab.
> [...]
> Hat jemand ein einfaches Kochrezept f�r mich mit dem man Hugin zum laufen bekommt?
Zu Mac-OS kann ich Dir leider nichts helfen. Ich benutze align_image_stack
(aus der Hugin-Distribution) Version 2013.0.0.0d404a7088e6 und enfuse
4.1.1 von [1](in den jeweiligen 64-Bit-Versionen), die ich mir separat
heruntergeladen habe. Allerdings sollte auch beim neuen Hugin-Release [2]
was Brauchbares dabeisein.
M. M. n. ist die Hugin-GUI f�rs Focusstacken nicht unbedingt geeignet (mag
mich da aber auch t�uschen). Ich benutze zwei simple Batchskripte zum
Ausrichten und Skalieren der Bilder (fokusabh�ngige Brennweite, wackeliges
Stativ, etc.) und dann eben enblend mit einem Parametersatz, der f�r
Focusstacking geeignet ist, was sich auch mit dem Tutorial von Eduardo
Perez (s. [3]) deckt.
Prinzipiell ruft man
align_image_stack.exe -v -m -a aligned bild1 bild2 bild3 ...
auf, erh�lt (wegen der Option -m, "Optimize field of view for all images,
except for first. Useful for aligning focus stacks with slightly different
magnification.") danach einen Satz ausgerichteter und auf gleichen Ma�stab
skalierte Bilder. Die werden dann mit
enfuse.exe --compression=lzw --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --contrast-window-size=9 --gray-projector=l-star -o fused.tif aligned_bild1 aligned_bild2 aligned_bild3 ...
zu einem Stack zusammengef�gt. An den Gewichten, der Fenstergr��e und
der Grauumrechnung kannst Du nat�rlich noch frickeln, das sind nur
Beispielparameter, die bei mir recht gut funktionieren.
S. dazu auch den Thread hierzugroup mit Subject "[NMZ] Drosophila" rings um
Message-ID: <1dfqxqg7oqoh9$.
d...@news.bartheld.net>.
Daraus:
Zum Ausrichten des Stapels und Ausgleich leicht unterschiedlicher
Abbildungsma�st�be:
<align.bat>
align_image_stack -a aligned -v -m *.png
</align.bat>
Zum Verschmelzen der scharfen Anteile:
<fuse.bat>
enfuse.exe --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --contrast-window-size=9 aligned_????.tif
</fuse.bat>
Ich verwendete zur Drosophila-Reihe die separate heruntergeladenen
Enblend/Enfuse-Pakete (V3.2 ist �brigens das letzte, mit Win2K
funktionierende Release, aktuell ist 4.1.1, unterst�tzt in einem separaten
Binary auch Multiprozessorplattformen) als auch die Hugin-Distribution.
Das ist letztlich Jacke wie Hose.
Die (Kommandozeilen)Syntax der 3.2 unterscheidet sich signifikant von der
4.1.1, speziell f�r Fokusstacking relevante Parameter wie
--wExposure -> --exposure-weight
--wSaturation -> --saturation-weight
--wContrast -> --saturation-weight
--HardMask -> --hard-mask
--ContrastWindowSize -> --contrast-window-size
m�ssen angepa�t werden, da hat offenbar jemand eine defekte Shifttaste
gehabt, aufger�umt und reichlich Bindestriche verteilt. In der Folge ist
auch die Wiki [4] veraltet, die aktuelle Doku findet sich z. B. unter
[5].
In der Proze�kette hat sich herausgestellt, da� die Ausrichtung
mikroskopischer (und NUR dieser!) Bilder mit
align_image_stack.exe -a aligned -v -m input_files
weitestgehend unn�tig ist (zu Details s. [6]), da das bei vielen
(Makro)Objektiven auftretenden "Focusbreathing" (Ver�nderung des
Abbildungsma�stabs beim Fokussieren) im Vergleich zur Objektgr��e
vernachl�ssigbar ist, jedenfalls, wenn es sich um mikroskopische Bilder
von relativ kleinen Objekten handelt.
Gelegentlich scheitern auch neuere Versionen von align_image_stack
spektakul�r am Ausrichtungsversuch (es werden winzige Thumbnails
produziert oder nur kleine Teilausschnitte des Gesamtbilds bleiben �brig),
das liegt vermutlich am extrem geringen Sch�rfentiefebereich bei
mikroskopischen Bildern, die keinerlei Kontrollpunkte mehr liefern.
�brigens sollte man auf Windowsplattformen mit Wildcards vorsichtig sein -
so funktioniert align_image_stack [options] DSC_????.png bei mir
genausowenig wie enfuse [options] aligned????.tif. Man mu� sich also
entweder die Hugin-Droplets entsprechend hinbiegen (das sind kleine
Batchprogramme, auf die man eine Auswahl von Bilddateien werfen kann) oder
sinngem�� eine Liste der relevanten Dateien erstellen, z. B. mit dir /b
DSC_*.png >> align.bat.
Ich habe mir zwei Skelette erzeugt
<align.bat>
align_image_stack -a aligned -v -m
</align.bat>
und
<fuse.bat>
enfuse.exe --exposure-weight=0 --saturation-weight=0 --contrast-weight=1
--hard-mask --contrast-window-size=9
</fuse.bat>
, die ich jeweils entsprechend modifiziere.
Bei den schmalen Sch�rfentiefen mikroskopischer Aufnahmen entstehen nahezu
zwangsl�ufig Halos (Objekte, die sich au�erhalb des Fokus befinden,
bekommen einen enormen Zerstreuungskreis, der die scharfen Anteile der
darunter- oder dar�berliegenden Bilder in Mitleidenschaft zieht), die das
Motiv im Endeffekt etwas �berstrahlt/selbstleuchtend wirken lassen. Dieses
Problem bekommt man zu einem gewissen Teil �ber die Gr��e des
Kontrastfensters (bei mir nahezu wirkungslos) bzw. die
Graustufenprojektion in den Griff.
Wer keine Angst vor enormer Rechenzeit hat, kann gerne auch mal
enfuse --HardMask --ContrastWindowSize=9 --wExposure=0 --wSaturation=0
--wContrast=1 --compression=LZW --GrayProjector=l-star
versuchen, das brachte bei mir eine gewisse (aber nicht �berragende)
Verbesserung.
Ob es diesen Zusammenschrieb schon in der drf-Wiki [7] gibt, wei� ich nicht
- ich ermutige den/die Gralsh�ter der drf-FAQ (z. B. Exi) aber
ausdr�cklich das zu tun. Meine Focusstackingdroplet [8] h�nge ich hier
unten an, dann ist das HowTo einigerma�en komplett. Ich bitte um
Nachsicht, falls das Posting dadurch etwas l�nglich ger�t.
Alternativen zu align_image_stack und enfuse w�ren beispielsweise Helicon
Focus, StackShot, CombineZP/ZM, Picolay und ZereneStacker, z. T. aber
Kaufware.
Viel Erfolg und Gr��e,
Volker
[1]
http://enblend.sourceforge.net
[2]
http://hugin.sourceforge.net
[3]
http://photoblog.edu-perez.com/2009/01/greater-depth-field-macro.html
[4]
http://wiki.panotools.org/Enfuse
[5]
http://panorama.dyndns.org/EandE-documentation/enfuse.html
[6]
http://wiki.panotools.org/Align_image_stack
[7]
http://faq.d-r-f.de/wiki/Portal:EBV
[8] Der Vorteil eines "Droplets" ist, da� man sich einen Link auf das
Skript auf den Desktop legt und dann einfach mit dem Explorer (oder sonst
einem Filemanager) eine Ladung Bilder darauffallen lassen kann, die das
Skript dann automagisch bearbeitet.
<align_droplet.bat>
@ECHO off
SET align_additional_parameters=-v -m
ECHO This is align_droplet, an image alignment batch file V0.0.1
ECHO (C) Volker Bartheld -
http://bartheld.net
ECHO.
REM Check, if command extensions are available
VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 GOTO :No_Extensions_Error
REM Try to locate align_image_stack in %PATH%
align_image_stack.exe -h > nul
IF %ERRORLEVEL% NEQ 0 GOTO :No_align_image_stack_Error
REM If called directly (no command line arguments) or help requested: Display some usage hints
IF "%1" EQU "" GOTO :print_help
IF "%1" EQU "--help" GOTO :print_help
IF "%1" EQU "/?" GOTO :print_help
REM Check if command line argument is a folder (by trying to cd into it)
PUSHD "%~1" 2>nul
POPD
IF NOT ERRORLEVEL 1 GOTO :IsDir
REM Apparently these are files: align them.
ECHO Aligning %*...
align_image_stack.exe %align_additional_parameters% -a "%~dpn1_aligned" %*
REM Done.
GOTO :ready
REM We have a folder...
:IsDir
REM We need delayed environment variable expansion in order to count files
SETLOCAL ENABLEDELAYEDEXPANSION
REM Inform user ...
ECHO Processing directory: %1\
ECHO.
ECHO Please specify number of files in one bracketed series
ECHO or "A" for all files in the directory, then press [Enter]
REM ... and ask what to do
SET /P align_number_of_files=Your input:
REM Init variables
SET align_files=
SET CNT=0
REM Init temporary batch file
REM We need this in order to avoid that the created files are included as well
FOR /f "skip=1" %%d IN ('wmic os get localdatetime') DO IF NOT DEFINED YYYYMMDD SET YYYYMMDD=%%d
SET YYYYMMDD=%YYYYMMDD:~0,8%
SET align_base=~align_tmp
IF "%YYYYMMDD%" EQU "" GOTO :YYYYMMDD_FAIL
SET align_temp=%align_base%%YYYYMMDD%.bat
ECHO @ECHO OFF > %align_temp%
REM Loop over all jpg and tif files in the respective folder
FOR %%I in ("%~1\*.jpg" "%~1\*.tif" "%~1\*.png") DO CALL :loop "%%I"
REM Skip subroutine
GOTO skip_loop
REM Loop
:loop
REM Increment count
SET /A CNT+=1
REM Remember the first file name of each series
IF !CNT! EQU 1 SET align_first_file=%~dpn1
REM As long as number not reached...
if !CNT! LSS %align_number_of_files% (
REM ... add files to the command line
SET align_files=!align_files! "%~1"
) ELSE (
REM If number reached write the result to the temp batch file.
REM Remember to add current file!
ECHO align_image_stack.exe %align_additional_parameters% -a "%align_first_file%_aligned" %align_files% "%~1" >> %align_temp%
REM init variables
SET align_files=
SET CNT=0
)
GOTO :eof
REM End of subroutine.
:skip_loop
REM if there are still files left, add them as well
IF !CNT! NEQ 0 ECHO align_image_stack.exe %align_additional_parameters% -a "%align_first_file%_aligned" %align_files% >> %align_temp%
REM Call temporary batch file to execute enfuse...
ECHO Executing: "%align_temp%" to align images...
CALL %align_temp%
DEL %align_temp% /q
REM Done.
ENDLOCAL
GOTO :ready
:No_Extensions_Error
ECHO Error: Unable to enable command extensions.
ECHO Either you have a very old command interpreter
ECHO or you use a too old windows version.
ECHO Sorry, this won't work on your machine...
GOTO :ready
:No_align_image_stack_Error
ECHO Error: Unable to find align_image_stack.exe.
ECHO Make sure this batch file is in the same folder as align_image_stack.exe
ECHO or set your PATH environment variable correctly.
GOTO :ready
:print_help
ECHO Usage:
ECHO Create a shortcut for this batch file on the desktop or in any folder.
ECHO.
ECHO There are two ways to use this droplet:
ECHO 1. Drag and drop some images (a bracketed series) onto the droplet to
ECHO align them.
ECHO The result will be a .tif file named like the first image of the
ECHO series plus "_aligned" added to the file name.
ECHO 2. drag and drop a folder on the droplet. You will be asked to
ECHO specify how many images are in a bracketed series or whether
ECHO you want to align all images in the folder.
ECHO The result will be .tif files named like the first image of each
ECHO series plus "_aligned" added to the file name.
GOTO :ready
:YYYYMMDD_FAIL
ECHO Error: Unable to create temporary file.
ECHO ('wmic os get localdatetime' returned an error.)
GOTO :ready
:ready
REM Clean up environment
SET align_additional_parameters=
SET align_number_of_files=
SET align_files=
SET align_first_file=
SET CNT=
SET YYYYMMDD=
SET align_base=
SET align_temp=
ENDLOCAL
ECHO.
ECHO Thank you for using the align droplet!
PAUSE
EXIT /B
</align_droplet.bat>
<stack_droplet.bat>
@ECHO off
SET enfuse_additional_parameters= --compression=lzw --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask --contrast-window-size=9 --gray-projector=l-star
ECHO This is stack_droplet, a focus stacking batch file V0.0.1
ECHO (C) Volker Bartheld -
http://bartheld.net
ECHO.
REM Check, if command extensions are available
VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 GOTO :No_Extensions_Error
REM Try to locate enfuse in %PATH%
enfuse.exe --version > nul
IF %ERRORLEVEL% NEQ 0 GOTO :No_enfuse_Error
REM If called directly (no command line arguments) or help requested: Display some usage hints
IF "%1" EQU "" GOTO :print_help
IF "%1" EQU "--help" GOTO :print_help
IF "%1" EQU "/?" GOTO :print_help
REM Check if command line argument is a folder (by trying to cd into it)
PUSHD "%~1" 2>nul
POPD
IF NOT ERRORLEVEL 1 GOTO :IsDir
REM Apparently these are files: fuse them.
ECHO Fusing %*...
enfuse.exe %enfuse_additional_parameters% -o "%~dpn1_fused.tif" %*
REM Done.
GOTO :ready
REM We have a folder...
:IsDir
REM We need delayed environment variable expansion in order to count files
SETLOCAL ENABLEDELAYEDEXPANSION
REM Inform user ...
ECHO Processing directory: %1\
ECHO.
ECHO Please specify number of files in one bracketed series
ECHO or "A" for all files in the directory, then press [Enter]
REM ... and ask what to do
SET /P enfuse_number_of_files=Your input:
REM Init variables
SET enfuse_files=
SET CNT=0
REM Init temporary batch file
REM We need this in order to avoid that the created files are included as well
FOR /f "skip=1" %%d IN ('wmic os get localdatetime') DO IF NOT DEFINED YYYYMMDD SET YYYYMMDD=%%d
SET YYYYMMDD=%YYYYMMDD:~0,8%
SET enfuse_base=~enfuse_tmp
IF "%YYYYMMDD%" EQU "" GOTO :YYYYMMDD_FAIL
SET enfuse_temp=%enfuse_base%%YYYYMMDD%.bat
ECHO @ECHO OFF > %enfuse_temp%
REM Loop over all jpg and tif files in the respective folder
FOR %%I in ("%~1\*.jpg" "%~1\*.tif") DO CALL :loop "%%I"
REM Skip subroutine
GOTO skip_loop
REM Loop
:loop
REM Increment count
SET /A CNT+=1
REM Remember the first file name of each series
IF !CNT! EQU 1 SET enfuse_first_file=%~dpn1
REM As long as number not reached...
if !CNT! LSS %enfuse_number_of_files% (
REM ... add files to the command line
SET enfuse_files=!enfuse_files! "%~1"
) ELSE (
REM If number reached write the result to the temp batch file.
REM Remember to add current file!
ECHO enfuse.exe %enfuse_additional_parameters% -o "%enfuse_first_file%_fused.tif" %enfuse_files% "%~1" >> %enfuse_temp%
REM init variables
SET enfuse_files=
SET CNT=0
)
GOTO :eof
REM End of subroutine.
:skip_loop
REM if there are still files left, add them as well
IF !CNT! NEQ 0 ECHO enfuse.exe %enfuse_additional_parameters% -o "%enfuse_first_file%_fused.tif" %enfuse_files% >> %enfuse_temp%
REM Call temporary batch file to execute enfuse...
ECHO Executing: "%enfuse_temp%" to fuse image stacks...
CALL %enfuse_temp%
DEL %enfuse_temp% /q
REM Done.
ENDLOCAL
GOTO :ready
:No_Extensions_Error
ECHO Error: Unable to enable command extensions.
ECHO Either you have a very old command interpreter
ECHO or you use a too old windows version.
ECHO Sorry, this won't work on your machine...
GOTO :ready
:No_enfuse_Error
ECHO Error: Unable to find enfuse.exe
ECHO Make sure this batch file is in the same folder as enfuse.exe
ECHO or set your PATH environment variable correctly.
GOTO :ready
:print_help
ECHO Usage:
ECHO Create a shortcut for this batch file on the desktop or in any folder.
ECHO.
ECHO There are two ways to use this droplet:
ECHO 1. Drag and drop some images (a bracketed series) onto the droplet to
ECHO focus stack them.
ECHO The result will be a .tif file named like the first image of the
ECHO series plus "_fused" added to the file name.
ECHO 2. drag and drop a folder on the droplet. You will be asked to
ECHO specify how many images are in a bracketed series or whether
ECHO you want to fuse all images in the folder.
ECHO The result will be .tif files named like the first image of each
ECHO series plus "_fused" added to the file name.
GOTO :ready
:YYYYMMDD_FAIL
ECHO Error: Unable to create temporary file.
ECHO ('wmic os get localdatetime' returned an error.)
GOTO :ready
:ready
REM Clean up environment
SET enfuse_additional_parameters=
SET enfuse_number_of_files=
SET enfuse_files=
SET enfuse_first_file=
SET CNT=
SET YYYYMMDD=
SET enfuse_base=
SET enfuse_temp=
ENDLOCAL
ECHO.
ECHO Thank you for using the stack droplet!
PAUSE
EXIT /B
</stack_droplet.bat>
--
@: I N F O at B A R T H E L D dot N E T
3W:
www.bartheld.net