dat-ng / ar-location-based-android

This AR app generally show where things are in the real-world by indicating where the app thinks they are over the camera view when the user holds the phone up and moves it about.
MIT License
203 stars 85 forks source link

Running sample has green overlay over camera, how to remove it? #23

Open falbertp opened 6 years ago

falbertp commented 6 years ago

Hi, I am running the example code, but the camera has been overlayed by green screen with normal rectangular screen on top right corner. How to remove the green overlay?

Thank you

ShantiRanjanDas commented 6 years ago

Just use this in initCamera in ArActivity. This solves my two problems.

  1. Green overlay over camera.
  2. Camera view is stretched(people and objects are distorted).

List mSupportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes(); Camera.Size mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes,metrics.widthPixels, metrics.heightPixels); Camera.Parameters parameters = camera.getParameters(); parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height); camera.setParameters(parameters); camera.startPreview(); arCamera.setCamera(camera);

I am getting this issue in Redmi devices.

AbhishekPandey21 commented 4 years ago

getting an error-: Cannot resolve getOptimalPreviewSize method. please specify the metric variables