-
Notifications
You must be signed in to change notification settings - Fork 51
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
Auto Focus #24
Comments
cool! but when the camera is in autofocus mode, doesn't it do this every time you take a picture anyway? is this so that you have control on every shot for whether to autofocus or not? |
Yes ! It's so you have control ! Right now if the camera is in AF mode and focus fails, you don't get a picture ... This allows you to take pictures without trying to focus, or to take the picture despite AF failing. Maybe it can be a flag on the takePicture function... and I'm not sure if it makes sense to expose whether focus failed or not... |
great :)
if you can do these things i'd be happy to merge your work! |
@thiagohersan I'm not sure if the logic for focus is right -- I think it's better to look at justFocus != 0... also, I've found that to keep my camera out of an infinite focusing loop I basically either do: a) justFocus != 0 b) justFocus == 0 this keeps me from stalling out, some of the other logic about 17/16 etc I think is based on the fact that justFocus seems to give back the number of focus frames or some other info, but if you look at the docs, it looks like it should be interpreted more simply
I'm still not super sure how to read this kEdsPropID_FocusInfo struct (the documentation is super thin), but at any rate, thought I should flag that for me, != 0 is a pretty good check and keeps me from getting stuck in a weird state, where I continually re-focus. (I'm working on this because without auto focus, I get stuck taking continually a picture when the focus is not good) thanks! |
Hi @ofZach . I think you're right regarding the numbers for justFocus. I remember that depending on the condition and state of the camera I would get very different numbers, and the SDK doc was not very helpful. So, that makes sense. What I needed was something that would try to focus, if it succeed, then take many pictures, if it didn't successfully focus, then just take one picture and try the whole thing again at a later time. My code might be a bit specific to that situation, and I meant to clean it up and make more generic functions to enable taking pictures without trying to focus, or to take the picture despite AF failing.... but.... my camera got stolen and I haven't replaced it. |
oh sorry to hear that! I've found your code very helpful -- especially the take photo without focus (since the way the logic works with my camera, I'd get stuck in a pretty painful loop trying to take a picture when it can't focus). I will try to poke around more and see what I can find out about the API for focusing... |
I have been playing with this addon tonight and i think the fix for failed autofocus is much simpler than @thiagohersan's proposed patch. In the if(needToTakePhoto) { try { section, you can replace TakePicture with 2 kEdsCameraCommand_PressShutterButton calls. If the AF fails, the exposure won't even be attempted and for good measure you can depress the shutter in the catch. I can try to get a patch out shortly for this. |
@plural I'd be interested in seeing this patch... |
Not an issue, but I added some logic to your magic to make the camera try to focus before taking a picture (the equivalent of pressing the shutter button down halfway).
You can see the diff here.
If this is something you might want in the addon we can negotiate a PR (what I mean is: I might need to clean up the code, or make it more understandable, or merge my
takePhotoAF()
function intotakePhoto()
: )Let me know.
The text was updated successfully, but these errors were encountered: