- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在开发一个应用程序,该应用程序使用 iOS 8 中引入的新 API 公开相机的手动控制,我正在使用这个 sample app来自 WWDC 2014 作为引用。
但是我注意到一个奇怪的行为(在我的 5s 和 6 上):将曝光模式设置为“自定义”然后返回“自动”后,图像继续滞后,好像曝光持续时间不受此影响改变。
以下是每个步骤中涉及的代码(来自示例应用程序,未经任何修改):
- (IBAction)changeExposureMode:(id)sender
{
UISegmentedControl *control = sender;
NSError *error = nil;
AVCaptureExposureMode mode = (AVCaptureExposureMode)[self.exposureModes[control.selectedSegmentIndex] intValue];
if ([self.videoDevice lockForConfiguration:&error])
{
if ([self.videoDevice isExposureModeSupported:mode])
{
[self.videoDevice setExposureMode:mode];
}
else
{
NSLog(@"Exposure mode %@ is not supported. Exposure mode is %@.", [self stringFromExposureMode:mode], [self stringFromExposureMode:self.videoDevice.exposureMode]);
}
}
else
{
NSLog(@"%@", error);
}
}
- (IBAction)changeExposureDuration:(id)sender
{
UISlider *control = sender;
NSError *error = nil;
double p = pow( control.value, EXPOSURE_DURATION_POWER ); // Apply power function to expand slider's low-end range
double minDurationSeconds = MAX(CMTimeGetSeconds(self.videoDevice.activeFormat.minExposureDuration), EXPOSURE_MINIMUM_DURATION);
double maxDurationSeconds = CMTimeGetSeconds(self.videoDevice.activeFormat.maxExposureDuration);
double newDurationSeconds = p * ( maxDurationSeconds - minDurationSeconds ) + minDurationSeconds; // Scale from 0-1 slider range to actual duration
if (self.videoDevice.exposureMode == AVCaptureExposureModeCustom)
{
if ( newDurationSeconds < 1 )
{
int digits = MAX( 0, 2 + floor( log10( newDurationSeconds ) ) );
self.exposureDurationValueLabel.text = [NSString stringWithFormat:@"1/%.*f", digits, 1/newDurationSeconds];
}
else
{
self.exposureDurationValueLabel.text = [NSString stringWithFormat:@"%.2f", newDurationSeconds];
}
}
if ([self.videoDevice lockForConfiguration:&error])
{
[self.videoDevice setExposureModeCustomWithDuration:CMTimeMakeWithSeconds(newDurationSeconds, 1000*1000*1000) ISO:AVCaptureISOCurrent completionHandler:nil];
}
else
{
NSLog(@"%@", error);
}
}
最佳答案
我也注意到了这一点。这似乎与较慢的快门速度有关。试试这个:转到自定义。设置较快的快门速度。然后返回自动。繁荣,你就在那里。现在,转到自定义,设置较慢的快门速度(向右滑动)。返回自动,您可以看到快门速度逐渐回到合理的设置。
示例代码和我根据示例代码编写的应用程序都是这种情况。我的4s和5s也是一样的。
我认为这是因为传感器需要捕捉一定数量的图像才能选择正确的自动设置。如果快门速度非常慢(最多 1 秒),这意味着可能需要几秒钟才能找到正确的设置。有点道理,即使不是我们想要的。对我来说幸运的是,如果超过四分之一秒,我的应用程序不需要超过四分之一秒的快门速度。
关于ios - 修改曝光持续时间并返回 AVCaptureExposureModeContinuousAutoExposure 后的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26312634/
我正在使用navigator.getUserMedia限制访问用户的网络摄像头,使用提要作为 HTML 的源 然后将其流复制到 drawImage一个语境。我这样做是为了每隔一段时间就拍一张快照。 我
我有一个数据层(包含与 MongoDB 的连接)、一个域层(包含存储库和实体)和一个服务层(包含服务和模型) 现在因为我的实体使用 ObjectId,它们需要 MongoDB 的知识(这样可以吗?)
现在在我的相机应用程序中,我允许用户触摸任意位置来设置焦点和曝光,但我如何才能像 Apple 的相机应用程序一样获得两全其美的效果? 例如,用户可能希望通过触摸来聚焦前景中的某物,但如果场景变化足够大
我想实现标准的用户体验,在预览中点击一个点,以将自动对焦和自动曝光点调整到他们点击的位置。我找到了 Preview.focus() 函数,但是它说它需要“传感器坐标系”中的尺寸,我假设它与 Textu
我需要对大量照片进行排序,去除模糊图像(由于相机抖动)、曝光过度/不足的图像,并检测图像是横向还是纵向拍摄。这些事情可以使用图像处理库在图像上完成吗?或者它们仍然超出算法解决方案的范围吗? 最佳答案
我正在尝试调整网络摄像头的亮度。我需要 3 张不同亮度设置的不同照片。我不想让它成为手动的,所以如果想在程序中包含设置。 下面是我正在使用的代码。使用方法 GetFrame() 可以从网络摄像头获取下
我目前被困在图片视频项目上。 问题: 我正在从 UE4 中提取图片,由于一个错误,在屏幕截图的渲染过程中并未考虑所有灯光。输出是 HDR 图像。我想获得更好的亮度,因为导出的图片很暗,就像第一次曝光一
在过去的两天里,我遇到了 docker 问题,但我可以得到它。按照 docker 文档,您可以使用 EXPOSE 公开容器将监听连接的端口。到目前为止,一切都很好! 如果我的应用程序在端口 8080
自一周以来,我一直在尝试为我的 IOS 应用实现一些图像处理滤镜,如白平衡、曝光和分割色调(如在 Photoshop 中),但我没有获得实现其中任何一个的标准实现。 我通过ImageMagick找到了
据外媒 LOGGER 消息,小米手环 6 的信息在另一款智能手环应用Zepp中泄露。这款应用的固件代码中,出现了 “MI Smart Band 6”字样,还展现了其通过中国无线电认证的 CMIIT
据外媒Samsung Mobile报道,消息人士称,三星即将推出的Galaxy Watch智能手表将具有物理表圈。我们暂时将其称为Galaxy Watch 2。 去年,三星在八个月的时间内发布了两
我正在快速开发一个 MAC 应用程序,我现在可以在 NSView 上预览相机,我想更改亮度/对比度/白平衡和所有与相机相关的设置。 我正在使用 AVFoundation 框架来预览相机,我有 slid
据外媒 gsmarena 报道,realme Watch 2 已经通过了FCC 认证,并且被曝光了完整的设计规格。 realme Watch 2 代号为 RMW2008,屏幕方面与上一代相同,采用
我是一名优秀的程序员,十分优秀!