Comments (8)
Did you trigger af manually or set focus mode as CONTINUOUS_PICTURE?
from android-camera2basic.
I set focus mode to CONTINUOUS_PICTURE
from android-camera2basic.
Then maybe your focus area is too big, you can try another reasonable setting.
from android-camera2basic.
I have tried without setting any focus area and it does not work. It looks like it depends on the device, I have tested on a Motoroall Moto E, it is working, but it does NOT work on a Samsung S5.
from android-camera2basic.
Actually even the basic projet does not work on Samsung S5, I meant the continuous focus mode...
from android-camera2basic.
Hello @yaraki, did you have time to check this out? That's my priority now so we can even work together on that?
from android-camera2basic.
this working to me
`public void handleFocus(MotionEvent event) {
int pointerId = event.getPointerId(0);
int pointerIndex = event.findPointerIndex(pointerId);
// Get the pointer's current position
float x = event.getX(pointerIndex);
float y = event.getY(pointerIndex);
Rect touchRect = new Rect(
(int) (x - 100),
(int) (y - 100),
(int) (x + 100),
(int) (y + 100) );
if (mCameraId == null) return;
CameraManager cm = (CameraManager)this.getSystemService(Context.CAMERA_SERVICE);
CameraCharacteristics cc = null;
try {
cc = cm.getCameraCharacteristics(mCameraId);
} catch (CameraAccessException e) {
e.printStackTrace();
}
MeteringRectangle focusArea = new MeteringRectangle(touchRect,MeteringRectangle.METERING_WEIGHT_DONT_CARE);
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
try {
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
// After this, the camera will go back to the normal state of preview.
mState = STATE_PREVIEW;
} catch (CameraAccessException e){
// log
}
/* if (isMeteringAreaAESupported(cc)) {
*//*mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS,
new MeteringRectangle[]{focusArea});*//*
}
if (isMeteringAreaAFSupported(cc)) {
*//*mPreviewRequestBuilder
.set(CaptureRequest.CONTROL_AF_REGIONS, new MeteringRectangle[]{focusArea});
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_AUTO);*//*
}*/
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS,
new MeteringRectangle[]{focusArea});
mPreviewRequestBuilder
.set(CaptureRequest.CONTROL_AF_REGIONS, new MeteringRectangle[]{focusArea});
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
CameraMetadata.CONTROL_AF_TRIGGER_START);
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CameraMetadata.CONTROL_AE_PRECAPTURE_TRIGGER_START);
try {
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
/* mManualFocusEngaged = true;*/
} catch (CameraAccessException e) {
// error handling
}
}`
from android-camera2basic.
@yudikarma, it is a bit late for me, I am not working for the same company anymore but I appreciate you took the time to reply, I am sure it will help other people.
from android-camera2basic.
Related Issues (20)
- Taking several images in samsung galaxy 7
- Not Getting clear image in Lenovo Tablet Versions HOT 1
- Crash after lockscreen in landscape HOT 1
- InstanceCountViolation HOT 2
- Preview freeze HOT 1
- How to lock ISO or EXPOSURE_TIME when adjusting EXPOSURE_COMPENSATION? HOT 1
- android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList:283 HOT 10
- The application falls on huawei p8 lite 2017 HOT 1
- AutoFitTextureView capture's a frame that is not visible in camera preview HOT 1
- 疑问 HOT 2
- Usable API? HOT 1
- I/swiftshader: lock failed: buffer of 640x480 too small for window of 480x640 HOT 1
- Image gets rotated by 90 degrees left HOT 3
- how to take care of focus if the af_state return 0. Screen hangs with no camera capture HOT 1
- Native memory usage keeps increasing without interference in the Profiler HOT 1
- Camera2 API sucks HOT 1
- Error Take photo xaomi HOT 1
- why saved twice? HOT 1
- TextureView sometimes does not fit properly while switching between landscape and portrait mode HOT 1
- couldn't find "libnvision_core.so" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-camera2basic.