Focus stacking with smartphone – my experience with the Open Camera app

I have spent many hours at home during the past year creating focus stacked images of common household items – fruits, nuts, flowers. I used a DSLR initially, but later realized that my new smartphone was often surprising me with the quality and sharpness of pictures. So I thought of using it for focus stacking. Then discovered this camera app ‘Open Camera’ that made it quite easy and interesting.

Below are some of my learnings and tips for doing focus stacked photos with a smartphone and Open Camera app. I used the Android app, but the learnings should apply regardless of which smartphone app is used as long as it allows pro-mode controls and the camera hardware is reasonable. Open Camera does all that, plus has a special mode for focus stacking photography.

Are the final pictures comparable with DSLR or of professional quality? Probably not. You can take a look at some samples attached below. But I am not a professional photographer anyway, and am happy to produce nice pictures that look good just on a smartphone or a computer screen.

Equipment used-
OnePlus Nord Android smartphone
Open Camera app (
A mobile stand to position the phone usually in landscape mode.
Some improvised lighting and props found within the kitchen
A linux laptop with gimp, rawtherapee and few other tools.

Do you need a special smartphone model?
Probably not, but with some caveats. You would certainly need a good camera app that lets you shoot in macro/manual/pro mode with some control on focussing distance, exposure etc. I found that many budget phones had budget camera apps that had fixed picture modes that did not allow much manual control. So I looked around and discovered this nice FOSS app Open Camera in Google play store. It allows a much greater control on manual mode settings, and most importantly, has a special mode for focus stacking photography.

The other important thing is that this app can use Google’s camera2 API if the OS bundled with the android smartphone allows it. This was a key criterion for me for choosing a smartphone to buy. If the phone model grants this API access the third party apps (like Open Camera) could potentially exploit many more aspects of the settings that are ultimately implemented by the OS components. Such phones may also emit raw files (.dng) with the help of this API. But note that very few budget cameras may allow this API access, many flagships do, and some midrange phones also do. You can check the phone models that allow camera2 API access on the internet. There is also an android app that checks this for any android phone – See “Camera2 API Probe” on Google Play Store.

Which Open Camera settings were useful or critical?

The Open Camera settings are fairly generically named so should be self-explanatory for use on most other camera apps:

Focus-stacking mode (the most important)
Self timer : 2 or 5 secs - to avoid jerky clicking.
Focus peaking - to clearly verify the focused portions of the object
3x3 guides - to help decide which areas to focus and how many shots per area
Exposure lock - when you focus on diff parts of the object the camera would meter the light and could change the exposure. So this lock helped.
Exposure compensation - for the usual reasons.
Manual focus - to manually focus camera on the selected portion of the object.
RAW / JPEG - both used. JPEG used more often.
Focus assist - ability to zoom in to the frame to check focus (Used optionally. Looks like presently it cannot span the frame for locating parts of frame for focussing.)

Special focus-stacking mode of Open Camera app -
This app additionally allows multiple pictures shooting by automatically varying the focus from the closest portion of the object to the farthest portion of the object. You set the focus of these two extremes by two sliders. Then the app clicks a specified number of pictures (can be changed) by varying the focal lengths (possibly linearly). It can also (optionally) take an additional picture at the end with infinity focus to bring the background in sharp focus. A very special utility, indeed.

Why not use just the focus-stacking mode of Open Camera ?
In some cases I found that the focus-stacking mode did not cover some portions of the object possibly due to the intricate shapes of the objects. The additional difficulty is in actually making sure that you clearly see the peaking marks on the small screen and make a judgement that they are indeed adequate. You would realize this only when assembling the pictures in post-proc. But I feel this is quite reasonable – certainly not a limitation. So you might want to take a few more pictures outside the focus-stacking mode while the picture is still framed. Fortunately doing that is quite easy – it needs just one or two touches to get into manual mode and vice versa. But do keep the exposure lock on.

Pre-processing compositions
I found it useful to frame the picture totally, then take a trial shot in autofocus mode, upload that picture to a remote folder (all without disturbing the setup) and stare at the picture on another tablet to determine which areas should be covered by the focus (eg by considering the varying depths of field). Often I was impatient to get the pictures done without this step, but whenever I could bring myself to do this patiently, it was rewarding. It saved disappointments later. So this may be quite useful if you are doing a serious composition.

I have used JPEG mainly because I was happy with the OOC picture quality and details. I suppose you could do RAW (dng) too, but viewing them on the fly may be tough. I am not sure if using RAW in this specific situation would yield great advantages. It might if the object has special colors or features that need post-proc. But my guess is most people (like me) would find JPEGs adequate for the purpose.

Identifying picture sets-
I found that I was ending up with frighteningly high numbers of repeat shots of nearly identical composition for each object because of the simplicity of the focus-stacking mode (and also due to the time I had on hand due to the forced lockdowns!) So clubbing the pictures of each set was potentially tiresome. Fortunately, the focus-stacking mode generates sequentially numbered files like -0, -1, -2 etc. For manually shot pictures though the only trick that worked was to take a blank shot between the successive sets.


This is standard focus stacking process - nothing special for smartphones. I used three diff methods for putting together the focus stacked pictures:

1)Totally manually using rawtherapee and gimp (often using align of #2 below)

2)Automatically using Hugin components - align and enfuse
Thanks to Pat David for the post

3)Automatically using linux app focus-stack (Again thanks to Pat David for pointer)

A combination of #1 and #2 was used most commonly.

Some post-proc learnings with RT and gimp :

  • After loading and ordering the (aligned) picures as layers in gimp, do copy the entire set as another image (image–>duplicate) and keep that duplicate set untouched. It is often very useful to check which areas are inside or outside the focus on which picture/layer by consulting this duplicate image while you are processing one set.

  • RT helped immensely before and during gimp processing-

The focus mask of RT helped to check and select the best shots that should go into processing. Processing more than 4 or 5 layers in gimp is tiring. So chossing those best 4 or 5 pictures with best focus is very important.

RT batch edit was very useful to apply the chosen filters (eg crop) to the chosen set of pictures. Very useful if you find that some aspects like highlights/shadows or coloring needs change uniformly.

RT was running in a separate window on the laptop while doing gimp processing. This was useful to edit the gimp layer masks while checking focused areas in RT.

Sample focus stacked pictures (all done on the kitchen table)
(These files are licensed Creative Commons, By-Attribution, Share-Alike).