क्या एक सटीक ऑटो फोकस और AVFoundation कस्टम परत कैमरे के लिए एक्सपोजर बनाने के लिए सबसे अच्छा तरीका है ?, उदाहरण के लिए, वर्तमान में मेरे कैमरा पूर्वावलोकन परत वर्ग, है मैं कैमरा फ्रेम फोकस और एक्सपोजर उस फ्रेम को निर्दिष्ट करने के लिए निर्दिष्ट करना चाहते हैं। यदि संभव हो तो मुझे स्विफ्ट 2 में इसकी आवश्यकता है, अगर नहीं, तो कृपया अपना उत्तर लिखें, मैं इसे स्वयं परिवर्तित कर पाऊंगा।ऑटो फोकस और कस्टम कैमरा परत पर AVFoundation में ऑटो एक्सपोजर
वर्तमान ऑटो फोकस और एक्सपोजर: लेकिन जैसा कि आप देख सकते हैं कि यह ध्यान केंद्रित करते समय पूरे दृश्य का मूल्यांकन करेगा।
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
//Get Touch Point
let Point = touches.first!.locationInView(self.capture)
//Assign Auto Focus and Auto Exposour
if let device = currentCameraInput {
do {
try! device.lockForConfiguration()
if device.focusPointOfInterestSupported{
//Add Focus on Point
device.focusPointOfInterest = Point
device.focusMode = AVCaptureFocusMode.AutoFocus
}
if device.exposurePointOfInterestSupported{
//Add Exposure on Point
device.exposurePointOfInterest = Point
device.exposureMode = AVCaptureExposureMode.AutoExpose
}
device.unlockForConfiguration()
}
}
}
कैमरा परत: 1 में कुछ भी: 1 के अनुपात इस बाध्य भी कैमरा ध्यान देने के लिए एक स्पर्श घटना के रूप में नहीं माना जाएगा बाहर फ़ोकस और एक्सपोज़र बिंदु, और कुछ भी रूप में माना जाना चाहिए।
क्या आप AVCaptureVideoPreviewLayer का उपयोग कर रहे हैं? यदि ऐसा है: 'सार्वजनिक func captureDevicePointOfInterestForPoint (pointInLayer: CGPoint) -> CGPoint' – jlw
@jlw हाँ मैं 'AVCaptureVideoPreviewLayer' का उपयोग कर रहा हूं लेकिन मुझे वह फ़ंक्शन दिखाई नहीं देता है। :/ – Xrait
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureVideoPreviewLayer_Class/#//apple_ref/occ/instm/AVCaptureVideoPreviewLayer/captureDevicePointOfInterestForPoint: – jlw