Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挱 Is there a way to get the zoom thresholds where a multi-cam device switches between physical devices? #2725

Open
4 tasks done
oparisblue opened this issue Apr 8, 2024 · 1 comment
Labels
馃挱 question Further information is requested

Comments

@oparisblue
Copy link

oparisblue commented Apr 8, 2024

Question

Hi, apologies if this has already been asked, but I couldn't find it when searching or in the docs.

Is there a way to get the zoom levels at which a multi-cam device transitions between the physical cameras? For instance, how can we tell where the transition point from the wide angle to the ultra wide angle camera is?

What I'm looking for I guess would be something like:

const ranges = {
  ultraWideAngleRange: [0.5, 2],
  wideAngleRange: [2, 8],
  telephotoRange: [8, 128]
}

function switchToTelephoto() {
  camera.zoom = ranges.telephotoRange[0];
}

For context, we're trying to add some zoom buttons, much like those in the stock iOS camera, e.g. to set the zoom to 0.5x, 1x, 2x, 3x etc. I can't really find a way to do this with the current APIs, we can't find the zoom levels that these buttons should jump you to, and we can't find the real optical zoom level of each physical camera device (e.g. on the iPhone 16, the 3x button reads 5x in the stock UI; and it doesn't seem possible to detect that currently).

What I tried

I tried getting the physical cameras by themselves:

const devices = useCameraDevices();

const physicalDevices = devices.filter(({ isMultiCam }) => !isMultiCam);

console.log(
  physicalDevices.map(({ name, minZoom, maxZoom, formats }) => ({
    name,
    minZoom,
    maxZoom,
    formats: formats.map(({ maxZoom }) => maxZoom)
  }))
);

but, they all have their own zoom ranges, starting from 1 --- this doesn't really get us anything that helps figure out the zoom ranges of a multi-cam composed of these individual devices:

[
  { "name": "Back Camera", "minZoom": 1, "maxZoom": 123.75 },
  { "name": "Front Camera", "minZoom": 1, "maxZoom": 128.875 },
  { "name": "Back Telephoto Camera", "minZoom": 1, "maxZoom": 123.75 },
  { "name": "Back Ultra Wide Camera", "minZoom": 1, "maxZoom": 123.75 }
]

Likewise, there seem to be no properties on the CameraDevice object that return information about the optical characteristics of the device from which we could otherwise try to approximate these numbers, unless I'm missing something.

VisionCamera Version

3.9.0

Additional information

@oparisblue oparisblue added the 馃挱 question Further information is requested label Apr 8, 2024
@JesseLawler
Copy link

Excellent question! Wondering the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃挱 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants