figured out how to do a thing for a work project. a camera I work with, the mars hand lens imager (mahli) looks at mars rocks from only a few centimeters away. its photos also have a really shallow depth of field, so to get sharp images of rocks it uses focus stacking. this process takes several photos as the camera's focus mechanism racks through the full depth of field, then blends in the parts from each photo that are in focus.
the neat thing about this process is that both focus motor position is always precisely known for an image within a focus stack, and we know exactly how far from the camera objects will be in focus for a given motor position. so, when generating a merged sharpest focus image from the focus stack, we can also generate a range map where each pixel corresponds to the distance from the target.
we've been exploring some new ways of exploring this data, and in the process i've developed a python script that generates a 3d model and exports it as an embed within an html page. the pages are a little slow to load in a browser (the html files are ~70 mb in size), but it's really neat to be able to interact with a model without having to go to a third party host. here's a link to a model of little rock named jundia which was imaged on the 3687th day of curiosity's mission. it measures about 2.5 cm across.
