Camera2 stablization

Hi

I am developing android app for capturing videos and i am using camera2 api.
I have troubles with optical stabilization option in samsung S8.

in one device with this data :

  • Model: SM-G950F
  • Product: dreamltexx
  • Brand: samsung
  • Device: dreamlte
  • Version-Release: 9

characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION)

result is:
[LENS_OPTICAL_STABILIZATION_MODE_ON , LENS_OPTICAL_STABILIZATION_MODE_OFF]

but in the other device with this data:

  • Model: SM-G950W
  • Product: dreamqltevl
  • Brand: samsung
  • Device: dreamqltecan
  • Version-Release: 9

characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION)

result is:

[LENS_OPTICAL_STABILIZATION_MODE_OFF, LENS_OPTICAL_STABILIZATION_MODE_OFF]

this is my stabilization method:

private fun chooseStabilizationMode(builder: CaptureRequest.Builder?) {
 val availableOpticalStabilization = characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION)
 if (availableOpticalStabilization != null) {
  for (mode in availableOpticalStabilization) {
   if (mode == CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE_ON) {
    builder?.set(CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE, CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE_ON)
    builder?.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_OFF)
    showToast("Using optical stabilization.")
    return
   }
  }
 }

 // If no optical mode is available, try software.
 val availableVideoStabilization = characteristics.get(CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES)
 for (mode in availableVideoStabilization) {
  if (mode == CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_ON) {
   builder?.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE, CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_ON)
   builder?.set(CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE, CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE_OFF)
   showToast("Using video stabilization.")
   return
  }
 }

 showToast("Stabilization not available.")
}

in the one S8 say “Using optical stabilization.” and the other S8 say "Stabilization not available."

could you please help me to understand it?
Thanks in advance.

1 Like

what’s your point???

I think one of the devices may have restrictions based on place of manufacture. Also, check the permissions.

Thanks bolona for your answer.
All permissions is granted.

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2.full" />

Also result of

characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)

is

FULL

How can i make sure if device was restricted by manufacturer?

1 Like

I’m having the exact same problem with SM-G950F (European version) and SM-G950U (USA version).

Like in your case, SM-G950F returns LENS_OPTICAL_STABILIZATION_MODE_ON but SM-G950U don’t.

Hey… Apologies for Replying so late… You See… SM-G950F runs on Exynos 8895 Chipset
And both SM-G950W & SM-G950U run on Snapdragon 835 Chipset…

As I mentioned earlier(regarding the manufacturing restrictions), the Snapdragon version might not have enabled its support for Optical Stabilization as such. You may try adding the value for EIS, and see if it works.

Hope it helps… Much Love…

Thanks for your reply alokstates.

As i said i’m developing an application and i can’t access in all users device to enable any feature manually.
In your opinion there is any solution in my case?