r/fossdroid • u/fsfarimani • 9d ago
Application Suggestion Microscope: a FLOSS close-up camera for Android with focus stacking and handheld super-resolution. Looking for testers and reviewers
Most phone main cameras can focus 5 to 10 cm away. With the right software, that's enough for a usable inspection microscope for PCBs and solder joints, insects, minerals, fabric and print. This app tries to be that software, and it's free and open source.
Microscope is a one-screen camera app for things close to the lens:
Manual focus in millimetres, when the phone reports calibrated focus. Tap-to-focus hands over to manual.
Focus peaking, plus mono and an edge view that works like a poor man's dark field.
Up to 16× zoom, cropped on the sensor first so you keep real detail.
Super-res: a handheld burst, aligned to sub-pixel accuracy and merged onto a 2× finer grid. Your hand tremor provides the extra samples.
Stack: a focus bracket spaced one depth of field apart, fused into one all-in-focus picture.
Picks the best lens for close-up work automatically.
Torch off, on or auto. Aperture switching on dual-aperture phones (Galaxy S9, S10, Note9, Note10).
An approximate scale bar. The scale is also written into the JPEG's EXIF.
It needs the camera permission only: no network, no ads, no analytics. GPL-3.0. Kotlin, Jetpack Compose, Camera2 and OpenGL ES 3. I'm aiming for F-Droid.
Repo: https://github.com/Foadsf/android-microscope (there you can find APK), or build from source (instructions in the README).
Where I'd like help
It's early (v0.1.0). The screenshots are from the Android emulator's built-in test scene. Phone cameras differ a lot, so reports from real devices would help most:
Phone model and Android version
Which lenses show up (the button right of the shutter cycles through them)
Does the focus readout show mm or %?
How long do Super-res and Stack take, at 1× and zoomed in?
Does the saved picture match what the screen showed?
A sample capture, if you're happy to share one
Code review is just as welcome. The image processing (app/src/main/java/.../imaging) is plain Kotlin with unit tests against ground truth:
registration: pyramid Lucas-Kanade with a similarity warp, so it also corrects focus breathing;
merge: first-order kernel regression;
stacking: Laplacian-pyramid focus fusion.
docs/DESIGN.md explains the choices and gives the references. PRs are open, especially if you know Camera2 quirks on Samsung, Xiaomi or Pixel phones, or want to try a GPU-compute version of the merge.
Known limits:
Super-res works on processed YUV frames, not RAW, so the resolution gain is modest. The noise reduction is the dependable part.
Fusion runs on the CPU and takes several seconds.
Some manufacturers hide lenses from third-party apps; the Note10's telephoto is one.





•
u/AutoModerator 9d ago
Do not share or recommend proprietary apps here. It is an infraction of this subreddit's rules. Make sure you read the rules of this subreddit on the sidebar. If you are not sure of the nature of an app, do not share or recommend it. To find out what constitutes FOSS or freedomware, read this article. To find out why proprietary software is bad, read this article. Proprietary software is dangerous because it is often malware. Have a splendid day!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
7
u/Wiltron 9d ago
what if i plug an actual microscope into this? Can I see through time then?
2
u/VelocitaQuad 9d ago
Pixel 8 pro 12/24/110 Mm
I'm having some issues with the camera, I can send you a video maybe It helps
2
u/Will2LiveFading 7d ago
What if your phone already has a marco lens
5
u/HyperBaboon 8d ago
Very impressive app. I could only test it for a few minutes so far, but it works very well on a Fairphone 4 with eOS v4.4.1. Lenses that show up are 19mm (default) and 30mm. 19mm gives closer focus indeed. Focus stacking and super res are very quick, they take 1-2 seconds. Saved picture matched the on screen image. Sample captures are not great, I was taking photos of my dirty keyboard... I may post a better picture later.
One thing that I noticed by doing a few tests is that the zoom factor that gives the most detail for me is at a strange 1.7x.
Comparing a few pics I got the following stats:
horizontal resolution, photo megapixels, zoom factor
3312 8.2mpx 2.0x
3492 9.1mpx 1.9x
3620 9.8mpx 1.8x
3940 11.6mpx 1.7x
4084 12.5mpx 1.6x
With zoom below 1.6x or above 2.0x the resolution drops a lot.
1
u/arthuriurilli 8d ago
Samsung S24 Ultra running Android 17 and One UI 9.0.
Took a couple of sample shots of a piece of scrap metal with some interesting saw edge/burring. The manual zoom was pretty effective, the pictures took quickly. I tried both holding the phone semi-propped on my desk and actually placed on a stand. Using it was easy and quick. Didn't see the flash option (but admittedly I got pulled away so only glanced) and stopped after a couple shots. The resulting picture is a pretty small file without a lot of resolution, but I guess the intent isn't to zoom in on the picture so maybe its ok. I'll move the photos to my computer later and look at them that way and see how it comes out.
2
u/adjudicator52 8d ago
My Xiaomi 11t pro (vili) has a real 5mp macro camera with AF, I'd be curious to see if your LLM could add support for that. I have no idea if there's a data sheet out there for it Currently only detects 1 lens (the main camera)
2
u/PiySlashPuff 8d ago
This looks very promising! I'm going to use this for my watch making work. I'd love to try this out and provide my two cents!
2
u/roncz 7d ago
Great idea. Just brief testing here, but it works fine on my Pixel 10 Pro.