I could not find a solution with raw files. I know that the latest version of Hugin should support raw files with dcraw. I can not test it myself. The next good solution, in my opinion, is to convert and use all your raws in TIF files or other lossless image formats.
I have mainly for my method hugin_tools I also use the GUI on the terminal, so you have to have both installed.
The suit can be downloaded here.
I also use Ubuntu on my machine, but it should be the same on the Mac.
First You must put all the photos in a folder. This is mainly for the sake of simplicity, but later helps with the commands.
Generate a .pto file
Next, you'll need to create a .pto file. H. The file in which all image transformation data is stored.
You can do this by entering:
pto_gen * .jpg
in the terminal where all the photos are.
Pruning in a quiet area
Now you have to find matches between all your pictures. Before doing so, there is an optional part that greatly reduces errors when objects in your sentence are moving.
Open the created hugin project and change the user interface to "Advanced".
In the window that opens, go to the Masks tab, select the Cropping tab, and select your first image. Now make sure that "All images of the selected lens" is highlighted, and then drag from the edges of the image and the crop to the area with the least or no movement. This limits the match finder to this area and reduces errors in the remapping phase. Now you can save and quit the program.
Now you can find the matches. Enter:
cpfind --linearmatch * .pto
In the terminal, matches between image pairs are found.
You can also find matches between all images by simply omitting the "linear match" option. However, if you have hundreds of pictures, this can take a long time and is probably unnecessary.
Find out more about cpfind here.
Next you need to clean up the found control points. There are two commands for this:
celeste_standalone -i default.pto -o default.pto
tries to clear control points in clouds (more information here).
cpclean -o default.pto default.pto
removes control points with a high error value. (Cpclean help page)
Now that we have finished with the checkpoints, open the newly generated project named default and return to the Masks tab as before.
After that you have to optimize the control points. type:
pto_var –opty, p, r, TrX, TrY, TrZ -o default.pto default.pto
auto-optimizer -n -o default.pto default.pto
This optimizes the position and distortion of your image set. Find out more about this process here.
You are almost done, just enter:
pano_modify -o default.pto --projection = 0 --fov = AUTO --center --canvas = AUTO --crop = AUTOHDR --output - type = REMAPORIG default.pto
to change the project configuration.
At the end simply:
nona -m TIFF_m -o default.pto remapped
to output the newly assigned images.
If you also want to stack the images, you can also use the following:
hugin_stacker --output = median --mode = remapped median * .tif
For more information about the hugin command-line tools, click here.
That's it, my attitude to your problem exists, there are a few missing links, since this is my first answer, so I was limited to 8. If there are mistakes or you have problems, let me know, even my English is not the best, I'm sorry if I've made grammatical or spelling mistakes. Bottom up!