-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Support focus depth/distance #2937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Tested on multiple devices (pixel 6,cheap readmi, s23) and it worked without issues! |
|
Hey - thank you for your contribution this looks really cool! ❤️ I do think however that Also I can only merge this if it has both iOS and Android implementations. Can you make those changes? Thanks! |
|
ok for moving it as a prop, I've duplicated the logic initialy from the focus method, so I thought it made sense to do it that way. Quick question, do you think I should adjust the auto contrast stuff? It seems that on some device, the PR disable the auto exposure (AWB?), but not on all devices. I may add a button to toggle between a few exposure settings in Pl@ntNet but let me know what you think. |
|
Ah yeah I can see how it is very imperative, maybe a prop isn't the right idea after all. Is there no way to set focus distance via CameraX? |
That's why I want to avoid Camera2 interop 😅 I went through a lot of bullshit in VisionCamera V3 when I used Camera2 directly. It's such a wanky API that I want to stay away from it and handle everything through CameraX. If there's no way to use CameraX for it I don't know if I really want to merge this into main... |
|
I looked hard into cameraX and found no similar method, only having to use the interop methods. |
|
I really like the feature and I really want to have this in VisionCamera, but I am honestly not sure if it's a good idea to use Camera2.. sorry... Maybe we can create a feature request at the CameraX issue tracker and hope they add it to CameraX, then easily add it to VisionCamera? I'll think about this a bit. Maybe I can merge it, after all it's entirely optional anyways. From a user perspective, a prop sounds more logical. From an implementation perspective, it's an imperative function. Either way thank you for the contribution, I'll take a few days to think about this and then maybe pick this up again - maybe I'll also just do the iOS implementation then. Btw.; great news hearing that VisionCamera powers your app on thousands of devices out there. 💪 |
|
Ticket created: https://issuetracker.google.com/issues/346918497 |
|
Awesome, thank you! Let's hear what they say |
|
Hey guys |
|
I'll try to update the PR and add iOS support in the summer, the patch is still working fine for our users. |
ce56682 to
33c58f8
Compare
33c58f8 to
ebca62b
Compare
|
nice! |
|
The documentation still needs some work, I think the behavior is reverse between android and iOS. |
|
nice work guys |
ebca62b to
dbe3bda
Compare
|
Ok, I've gone and fixed the bun lockfile issue, kotlin and swift format, and updated the doc to clarify the usage (android and iOS are reversed in term of distance) |
|
for those wanted to test on their app, the patch is attached here. it was made using |
|
let me know @mrousavy if this PR needs any adjustment! |
|
Hey @mrousavy do you have any plan to merge this ? |
This PR add support for focus depth/distance on android and iOS.
This is based on this work: https://github.com/Fabi019/hid-barcode-scanner/blob/a38601ee94941304eaf515baa89cd5dbfc9ee092/app/src/main/java/dev/fabik/bluetoothhid/ui/model/CameraViewModel.kt#L60
Changes
device.minFocusDistancealready available.Tested on
Samsung S23. The feature was made for the Pl@ntNet plant identification app, and was used by without issues by a user base of around 5 millions on android.
iOS equivalent was tested on an iPhone SE 2022, and will be tested in production in September 2025.
Related issues
Relates to #1809
Demo
az_recorder_20240604_180249_edited.mp4