Photos & Camera

RSS for tag

Explore technical aspects of capturing high-quality photos and videos, including exposure control, focus modes, and RAW capture options.

Post

Replies

Boosts

Views

Activity

Launching an app with Camera Control
I've just received my iPhone 16 Pro to develop some of the Camera Control features. I am trying to set up my app to be launched from a button press, and from my research in the documents this is only possible if I develop a LockedCameraCaptureExtension. Is this correct? My app is written in React Native, so to build an extension would require me to re-create the entire UI in Swift which just isn't possible with my resources. Ideally I could build a simple extension that requires Authentication to open the app but I'n not sure that will work: The app extension terminates shortly after launch if it doesn’t have an active camera view that uses AVCaptureEventInteraction to handle events from the hardware buttons, or if access to the camera hasn’t been requested. This is a bit frustrating for something so simple as to just opening an app. Thanks, Alex
1
0
440
Sep ’24
Capture Extension Icon
Hello, I seem to be having an issue assigning my Capture Extension an icon. It works fine using a system icon, for example: Image(systemName: "star") But it fails when I use my custom icon, such as: Image(uiImage: UIImage(named: "widget-icon")!) The "widget-icon" is located in both my Assets collection and the widget folder for good measure, and yet, my Widget always has a "?" icon. I am able to use "widget-icon" just fine for other Lock Screen widgets, but it is not working for the Camera Extension Widget. Any thoughts? Thank you for your help!
2
0
287
Sep ’24
DockKit tracking becomes erratic with increased zoom factor in iOS app
I'm developing an iOS app using DockKit to control a motorized stand. I've noticed that as the zoom factor of the AVCaptureDevice increases, the stand's movement becomes increasingly erratic up and down, almost like a pendulum motion. I'm not sure why this is happening or how to fix it. Here's a simplified version of my tracking logic: func trackObject(_ boundingBox: CGRect, _ dockAccessory: DockAccessory) async throws { guard let device = AVCaptureDevice.default(for: .video), let input = try? AVCaptureDeviceInput(device: device) else { fatalError("Camera not available") } let currentZoomFactor = device.videoZoomFactor let dimensions = device.activeFormat.formatDescription.dimensions let referenceDimensions = CGSize(width: CGFloat(dimensions.width), height: CGFloat(dimensions.height)) let intrinsics = calculateIntrinsics(for: device, currentZoom: Double(currentZoomFactor)) let deviceOrientation = UIDevice.current.orientation let cameraOrientation: DockAccessory.CameraOrientation = { switch deviceOrientation { case .landscapeLeft: return .landscapeLeft case .landscapeRight: return .landscapeRight case .portrait: return .portrait case .portraitUpsideDown: return .portraitUpsideDown default: return .unknown } }() let cameraInfo = DockAccessory.CameraInformation( captureDevice: input.device.deviceType, cameraPosition: input.device.position, orientation: cameraOrientation, cameraIntrinsics: useIntrinsics ? intrinsics : nil, referenceDimensions: referenceDimensions ) let observation = DockAccessory.Observation( identifier: 0, type: .object, rect: boundingBox ) let observations = [observation] try await dockAccessory.track(observations, cameraInformation: cameraInfo) } func calculateIntrinsics(for device: AVCaptureDevice, currentZoom: Double) -> matrix_float3x3 { let dimensions = CMVideoFormatDescriptionGetDimensions(device.activeFormat.formatDescription) let width = Float(dimensions.width) let height = Float(dimensions.height) let diagonalPixels = sqrt(width * width + height * height) let estimatedFocalLength = diagonalPixels * 0.8 let fx = Float(estimatedFocalLength) * Float(currentZoom) let fy = fx let cx = width / 2.0 let cy = height / 2.0 return matrix_float3x3( SIMD3<Float>(fx, 0, cx), SIMD3<Float>(0, fy, cy), SIMD3<Float>(0, 0, 1) ) } I'm calling this function regularly (10-30 times per second) with updated bounding box information. The erratic movement seems to worsen as the zoom factor increases. Questions: Why might increasing the zoom factor cause this erratic movement? I'm currently calculating camera intrinsics based on the current zoom factor. Is this approach correct, or should I be doing something differently? Are there any other factors I should consider when using DockKit with a variable zoom? Could the frequency of calls to trackRider (10-30 times per second) be contributing to the erratic movement? If so, what would be an optimal frequency? Any insights or suggestions would be greatly appreciated. Thanks!
8
0
295
Sep ’24
AVCaptureSystemZoomSlider has a factor that I can't get anywhere.
As you can see, the value shown in the AVCaptureSystemZoomSlider is not the same as the raw camera zoom factor. I tried to calculate this value, and it seems it's 0.8. (5-1)*0.8=4.2-1 in this image. It seems this factor only applies to the default wide-angle camera. And I can't get this value from anywhere. (It's not displayVideoZoomFactorMultiplier btw, I checked that.) What is it?
1
1
333
Sep ’24
Moving Photos
How can it be that you still don't have the option to move photos into an album instead of just copying them? This is a bad joke, right? The entire Photos app is absolutely untidy and a nightmare for people who like order. I want car photos in the car folder. Vacation photos in the vacation folder without them being visible in the recent folder. Cant be so difficult???
3
0
199
Sep ’24
"Terminated due to signal 9" when launching app from camera button (iPhone 16 Pro)
Hello, I have followed the Creating a camera experience for the Lock Screen guide, and can now launch my app using the iPhone 16's new camera button. That said, after about 10 seconds the app is force-closed by the OS, with the only message appearing in the console: "Terminated due to signal 9". This error does not happen when: launching the app via physical camera button when device is locked launching the app by tapping the icon on the Home Screen It is only happening when: launching the app via physical camera button from the Home Screen when device is unlocked Any ideas? Thank you!
2
1
280
Sep ’24
Flag to avoid "shared is unavailable in application extensions" error?
Hello, I am trying to get my camera app to launch from the Lock Screen, and see that calls to UIApplication.shared are not allowed. In my app, I have: UIApplication.shared.isIdleTimerDisabled = true Which is causing this compile time error: 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead I do not believe there is a view controller based solution for this. Is there a flag I can wrap around the call so that the compiler knows it won't be used during an application extension? Thank you!
2
0
254
Sep ’24
iPhone 16 Pro Camera Preview freeze
Hi all, we are working on iOS application that includes the camera functionality. This week we have received a few customer complaints regarding the camera usage with iPhone 16/16 Pro, both of the customers said that they have an issue with the camera preview(when the camera is open) the camera preview is just freezer but any other functionally and UI works as expected. Moreover the issue happens only for back camera, the front camera works perfectly. We have tested it in context of iOS 18 with iPhone 14/15/15 Pro/15 Pro Max but all devices with iOS 18 works perfectly without any issues. So we assumed there was no issues with iOS 18 but some breaking changes with the new iPhone 16/16 pro cameras were introduced that caused this effect. Unfortunatly, currently we can't test directly usign the iPhone 16/16 Pro since we have't these devices. We are using SwiftUI framework and here the implementation of the camera preview: VideoPreviewLayer final class CameraPreviewView: UIView { var previewLayer: AVCaptureVideoPreviewLayer { guard let layer = layer as? AVCaptureVideoPreviewLayer else { fatalError("Layer expected is of type VideoPreviewLayer") } return layer } var session: AVCaptureSession? { get { return previewLayer.session } set { previewLayer.session = newValue } } override class var layerClass: AnyClass { AVCaptureVideoPreviewLayer.self } } UIKit -> SwiftUI struct CameraRecordingView: UIViewRepresentable { @ObservedObject var cameraManager: CameraManager func makeUIView(context: Context) -> CameraPreviewView { let previewView = CameraPreviewView() previewView.session = cameraManager.session /// AVCaptureSession previewView.previewLayer.videoGravity = .resizeAspectFill return previewView } func updateUIView(_ uiView: CameraPreviewView, context: Context) { } } Setup camera input private func saveInput(input: AVCaptureDevice) { /// Where input is AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) do { let cameraInput = try AVCaptureDeviceInput(device: input) if session.canAddInput(cameraInput) { session.addInput(cameraInput) /// session is AVCaptureSession } else { sendError(error: .cannotAddInput) status = .failed } } catch { if error.nsError.code == -11852 { sendError(error: .microphoneError) } else { sendError(error: .createCaptureInput(error)) } status = .failed } } Does anybody have similar issues with iPhone 16/16 Pro? We would appreciate any ideas of how to potentially resolve the issue.
1
0
421
Sep ’24
AVCaptureSessionControlsDelegate Not Being Called From Capture App
I am looking to learn more about the new Capture Button controls for iPhone 16, and am working to adapt the AVCam Sample Code to support the Capture Button. While I believe I've followed the guidance in the Enhancing your app experience with the Camera Control documentation, I'm finding that while my AVCaptureControl items seem to be added to the capture session, the Capture Button does not ever do anything, nor are any of the delegate methods called. After I configure my capture session per the setupSession() method, I'm calling a method I added, func configureCameraControls(device:AVCaptureDevice): func configureCameraControls(device: AVCaptureDevice) { guard captureSession.supportsControls else { assertionFailure("App does not support camera control.") return } // Set the controls delegate captureSession.setControlsDelegate(controlsDelegate, queue: sessionQueue) // Begin configuring the capture session. captureSession.beginConfiguration() // Remove previously configured controls, if any. for control in captureSession.controls { captureSession.removeControl(control) } // Add a zoom control let systemZoomSlider = AVCaptureSystemZoomSlider(device: device) { zoomFactor in // TODO } // Create a control to adjust the device's exposure bias. let systemBiasSlider = AVCaptureSystemExposureBiasSlider(device: device) // Add a custom slider let focusSlider = AVCaptureSlider("Focus", symbolName: "scope", in: 0...1) focusSlider.setActionQueue(sessionQueue) { focusValue in // TODO } // Iterate over the passed in controls. for control in [systemZoomSlider, systemBiasSlider, focusSlider] { // Add the control to the capture session if possible. if captureSession.canAddControl(control) { captureSession.addControl(control) } else { print("Unable to add control \(control).") } } // Commit the capture session configuration. captureSession.commitConfiguration() } I define the controls delegate like so: final class CaptureControlsDelegate: NSObject, AVCaptureSessionControlsDelegate { func sessionControlsDidBecomeActive(_ session: AVCaptureSession) { } func sessionControlsWillEnterFullscreenAppearance(_ session: AVCaptureSession) { } func sessionControlsWillExitFullscreenAppearance(_ session: AVCaptureSession) { } func sessionControlsDidBecomeInactive(_ session: AVCaptureSession) { } } Which I instantiate earlier on in my app's lifecycle and make available to the CaptureService actor. I'm not sure if this snippet can provide enough detail to gather some help, but I can't quite fathom why the camera/capture pipeline works, but I'm not getting any functionality from the Capture Button nor is the AVCaptureSessionControlsDelegate ever having its methods called.
3
0
349
Sep ’24
Issue with Sending Live Photos in Messages on iOS 18
Dear Apple Support, I’ve noticed an issue with the Messages app on iOS 18. When I try to send Live Photos, I select the Live Photo icon, but the photo is sent as a still image instead. Despite following the correct steps, the Live Photo feature doesn’t seem to be working properly. I would appreciate it if your team could look into this and resolve the issue in an upcoming update. Thank you for your support and continued innovation! Best regards, Erfan Nateghie
3
0
366
Sep ’24
Is it worth using Accelerate to convert 16 bpc RGB to 8 bpc RGB
I am working on an image processing app that requires 8 bit per channel (bpc) images. Sometimes, input images are 16 bpc (e.g. sRGB IEC61966-2.1; extended range) The app already draws the input image in a CGContext producing an 8 bpc CGImage. This works fine if the input is 16 bpc and I get an 8 bpc image. I am wondering if it would be better for image quality to convert the 16 bpc images to 8 bpc using Accelerate before that CGContext draw? or does that draw essentially do the equivalent?
0
0
162
Sep ’24
Challenges with Remotely Controlling iPhone Camera from Mac: Need Guidance
Hello everyone, I am working on an iOS app that involves capturing images automatically, and I would like to control the start/stop of the capture process remotely from a Mac app. I explored the iPhone Mirroring feature, which allows some remote control but has the limitation of only functioning when the iPhone is locked, and it doesn’t permit access to the iPhone’s camera from the Mac. Ideally, I am looking for a solution that would allow me to: Remotely control the camera capture process on the iOS app from the Mac app. Ensure the iPhone’s camera remains fully operational and controllable from the Mac during the capture process. I have considered using options like Handoff for communication between the apps but faced some issues while communicating between the iOS and mac app. I would like to know if there is a more optimal solution within Apple’s ecosystem, or if there are APIs I might have overlooked. Any advice or guidance on how to achieve this functionality would be greatly appreciated! Thanks in advance!
1
0
257
Sep ’24
session.openApplication() -- how to pass data from the extension to the application?
Hello, I apologize if the answer is obvious but I'm having a hard time figuring this one out. Let's say the user taps an "Edit" button in my LockedCameraCaptureSession. The extension calls: activity.userInfo = ["ActivityKey": "ID"] try await session.openApplication(for: activity) Can I retrieve, in my application, the data stored in activity.userInfo (lets say, a flag "open editor"), or is data passing exclusively handled via appContext of CameraCaptureIntent? Thank you!
3
0
214
Oct ’24
dyld[434]: Library not loaded: error when running LockedCameraCapture compatible app on iOS 15
Hello, I am getting the following error while attempting to run my LockedCameraCapture compatible app on an iOS 15 device: dyld[434]: Library not loaded: '/System/Library/Frameworks/LockedCameraCapture.framework/LockedCameraCapture' Referenced from: '/private/var/containers/Bundle/Application/.../MyApp.app/MyApp.debug.dylib' Reason: tried: '/System/Library/Frameworks/LockedCameraCapture.framework/LockedCameraCapture' (no such file) Of course iOS 15 doesn't have the library for LockedCameraCapture, but I have had no issue including Lock Screen Widgets (which require iOS 16), so I am not sure why the error is popping up. Thank you!
1
0
207
Oct ’24