Hi, I hav an app that works fine but I need to add autofocus, or at least refocus. I dont mind if the user has to tap to trigger focus, or if it is constant autofocus.
I saw a few posts, the only recent ones I saw are:
and
I did not have any luck makign this work with an iphone 6.
Has anyone out there got a solution?
One road I started down is to try and make it myself with objective C, how could I get access to the captureInput.device (the avfoundation grabber) from my ofApp.cpp to apply focus?
First of all, you can both set the focus to a specific distance (number between 0.0 and 1.0 where 0.0 is the closest distance and 1.0 is the furthest), or you can specify a set of XY coordinates for a location in your picture to set the focus point.
I added the following methods to AVFoundationVideoGrabber
Hey thanks that seems to work pretty well. In case anyone else sees this I had to wrap the objective C functions in AVFoundationVideoGrabber with C++ functions.
One thing that setFocusPointOfInterest needs a float between 0 and 1 for the position.
hello! after doing changes that pierdr suggests (and adding definitions in h file, i got an error:
Undefined symbols for architecture arm64:
“ofxiOSVideoGrabber::setAutofocusWithPointOfInterest(int, int)”, referenced from:
ofApp::touchDown(ofTouchEventArgs&) in ofApp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
what can i do?
im very new to cpp and of, thank u for detailed answer