12/31/2017 at 12:01 •
This is the continuation of the first part, of this Picam setup.
Taking HDRs with the Picam is very easy, and since we already take photos there's no reason to not do it.
The allowed values for camera.exposure_compensation are -25 to 25. Every 6 units represent 1 exposure stop:
for step in [-18, -12,-6,0,9]: camera.exposure_compensation = step camera.capture("hdr_imgs_" + step + ".png", "png")
-20 seems to be too dark, so the final image is not composed correctly. And 12 seems to be too bright.
If you take 7 images with this board, enfuse gets killed. So 5 images are good enough.
For compose the final image, the Picam uses enfuse:
enfuse --hard-mask --gray-projector=l-star hdr_imgs_*.png -o hdr_final.png
The mode l-star is the most natural for me.
Example of the effect on the same image taken by the Pi a couple of seconds apart:
As stated by some of the referenced links, there are many reasons to use align_image_stack prior to compose the final image:
/usr/bin/align_image_stack --gpu -v -a hdr_aligned_prefix_ hdr_temp_files*.jpg
However this process in the Pi takes eons (adds 20 minutes to the complete process), and the results are almost the same.
The final image can be improved using convert from the imagemagick package:
convert hdr_final.png -auto-level -contrast -modulate 100,150 -sharpen 0x1 hdr_final_enhanced.png
Some more examples:
Note: at least on the Raspberry Pi B+, if you have others tasks executing while you're composing the HDR, enfuse will run out of memory when composing 4 images.
To move it I tried to use the python lib RPIO.PWM, but after every move, it caused small spins which caused continuous vibrations on the Picam. So I ended up writing directly to the device /dev/pi-blaster.
If you turn this servo beyond its limits, the servo will keep trying to move...Read more »