I am
trying to use CameraX for image capture and capture preview. I found captured
image and preview image different for google pixel 5a, but for Samsung A72 device
captured image and preview image are same. For pixel phone, the captured image is
left aligned. For both Image analysis and PreviewView, I've set setTargetAspectRatio(AspectRatio.RATIO_4_3).
I have also tried to use ViewPort API to fix this issue. Any help will be
appreciated.
Code snipped is attached here.
@SuppressLint({"RestrictedApi", "WrongConstant", "UnsafeOptInUsageError"})
private void startCameraX(ProcessCameraProvider
cameraProvider) throws ExecutionException,
InterruptedException {
Preview preview = new Preview.Builder()
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
.build();
preview.setSurfaceProvider(previewView.getSurfaceProvider());
CameraSelector
cameraSelector;
cameraSelector
= new CameraSelector.Builder()
.requireLensFacing(LENS_FACING)
.build();
//
Image capture use case
imageCapture
= new
ImageCapture.Builder()
.setJpegQuality(100)
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
.setCameraSelector(cameraSelector)
.build();
Rational
aspectRatio = new Rational(previewView.getWidth(), previewView.getHeight());
ViewPort
viewPort = new ViewPort.Builder(aspectRatio,
preview.getTargetRotation()).setScaleType(ViewPort.FIT).build();
UseCaseGroup
useCaseGroup = new UseCaseGroup.Builder()
.setViewPort(viewPort)
.addUseCase(preview)
.addUseCase(imageCapture)
.build();
camera
= cameraProvider.bindToLifecycle(this, cameraSelector,useCaseGroup);
//
For performing operations that affect all outputs.
CameraControl
cameraControl = camera.getCameraControl();
cameraControl.setLinearZoom(zoom);
setCaptureRequestOptionsISOandShutterSpeed();
}
<androidx.camera.view.PreviewView
android:id="@+id/camera_preview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/CAHDOb3mU-uXeqTgsqz7KKxzS%3DxFo9vrF5kyjic9%2Bjbq5CSmnAw%40mail.gmail.com.
The test app is behaving as expected.On Tue, Sep 27, 2022 at 3:56 PM Mohammad Sajib Al Seraj <mals...@mtu.edu> wrote:Can you please share the source code link of the test app?
Thanks
MohammadOn Tue, Sep 27, 2022 at 3:55 PM Mohammad Sajib Al Seraj <mals...@mtu.edu> wrote:The test behaved normally. I am using relative layout. Do you think it might create an issue?
Thanks
MohammadOn Tue, Sep 27, 2022 at 3:42 PM Mohammad Sajib Al Seraj <mals...@mtu.edu> wrote:Thanks, I'll check it out.On Tue, Sep 27, 2022 at 3:36 PM Xi Zhang (张熹) <xi...@google.com> wrote:Sorry, that's the internal link. This public link should work:https://issuetracker.google.com/action/issues/247964494/attachments/39078078?download=trueOn Tue, Sep 27, 2022 at 12:27 PM Mohammad Sajib Al Seraj <mals...@mtu.edu> wrote:It is asking for SSO username and password. Do I have to create SSO account?
Thanks
Mohammad