Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. iPhone 14 Pro & Pro Max not focusing close-up with QCamera

iPhone 14 Pro & Pro Max not focusing close-up with QCamera

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 568 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pechman97
    wrote on last edited by
    #1

    Hi there everyone,

    I've recently encountered an issue on the iPhone 14 Pro (and Pro Max) in my Qt app. On all iPhone models except this one (including the 13's triple cam), I have been able to focus on close-up objects. However, on this model (on several tested devices), I cannot - this issue happens identically to the issue described in this thread https://developer.apple.com/forums/thread/715568.

    When using the iPhone 14 Pro's native camera app, as I bring an object close to the camera the app visibly and literally swaps lenses to use the macro lens. I would expect QCamera, the interface I use currently for all other phone models, would adapt similarly, but it does not. So I dug a little deeper to ensure I was using my available resources, and sure enough QCameraInfo::availableCameras() only returns the "front facing" and "back facing" cameras with no distinction between the lenses on the back facing ones, so I have no way to even manually tell my app to focus on close objects.

    I should note that Facebook & Instagram have also had this issue on the phone I personally tested, not that it is particularly relevant to the question.

    Is there a way I can select the macro lens? My application's core function is to scan documents, and it cannot do that without access to the lens for close-up pictures.

    Thank you!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pechman97
      wrote on last edited by pechman97
      #2

      I'm back with a development.

      TLDR: Qt 5 doesn't support Triple Camera lens. Try it on Qt 6 or find a way to route the iPhone's native software camera interface into Qt.

      As mentioned above, listing availableCameras() on the iPhone only reveals the front and back cameras. However, I forgot to mention that my app was on Qt 5.

      Using iPhone's AVCaptureDeviceDiscoverySession on native Objective-C shows me that I have 8 total cameras available to me. Most notably, index 7 contains the TripleCamera that I want to access (since it handles its own lens swapping). On Qt 5, I tried to force my QML Camera's device ID to be the TripleCamera's corresponding device ID by hardcoding it and running a debug session on my iPhone 14 Pro. No error was thrown, but examining the Camera's properties afterward shows me that the deviceId was forced back to device index 0 (the rear facing camera), which makes me think that index 7 wasn't supported.

      Notably, https://doc.qt.io/qt-6/qcamera.html#details shows that we can select the Macro lens in Qt 6, so I'm hopeful that Qt 6 will show all 8 camera options when using QMediaDevices::videoInputs() (Qt 6) instead of QCameraInfo::availableDevices (Qt 5). Would someone be able to test this for me? I forsee myself upgrading to Qt 6 eventually, but if it's the case that this issue has the solution I'm alluding to I'll probably upgrade sooner than later.

      Alternatively, I was thinking I could use apple's AVCaptureSession on Xcode 14 to generate a video feed and control the focus from there, but I am not sure how to route that directly to a viewfinder or Camera. If that's a possible solution I would be open to that as well.

      Would appreciate some input on this development! Thank you :)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved