gpt4 book ai didi

ios5 - 配置 iOS 相机参数以避免在视频预览中出现 strip

转载 作者:行者123 更新时间:2023-12-02 03:40:42 25 4
gpt4 key购买 nike

我有基于 OpenCV 的应用程序来处理图像。

我需要一个干净的图像来处理数据。当我在有荧光灯的区域时,它会在图像中出现一些 strip 。在 Android 中,我解决了配置相机参数 ANTIBANDING_50HZ 的问题,here是引用,它看起来和处理都正确。

但是在apple reference ,我找不到避免这个问题的方法。我一直在调整一些选项来改善图像,但它们并没有解决 strip 问题。

我的相机是使用此代码配置的:

- (BOOL) setupCaptureSessionParameters
{
NSLog(@"--- Configure Camera options...");
/*
* Create capture session with optimal size to OpenCV processing
*/
captureSession = [[AVCaptureSession alloc] init];
captureSession.sessionPreset = AVCaptureSessionPreset640x480;

AVCaptureDevice *cameraBack =[self videoDeviceWithPosition:AVCaptureDevicePositionBack];

if ([cameraBack lockForConfiguration:nil])
{
NSLog(@"lockForConfiguration...");
// No autofocus
if ( [cameraBack isFocusModeSupported:AVCaptureFocusModeLocked])
{
cameraBack.focusMode = AVCaptureFocusModeLocked;

}
// Focus center image always
if ( [cameraBack isFocusPointOfInterestSupported])
{
cameraBack.focusPointOfInterest = CGPointMake(0.5, 0.5);
}
// Autoexpose color is have a several change of lights
if ( [cameraBack isExposurePointOfInterestSupported] )
{
cameraBack.exposureMode = AVCaptureExposureModeContinuousAutoExposure;
}
// Auto adjust white balance is user aim to a reflectant surface
if ( [cameraBack isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance])
{
cameraBack.whiteBalanceMode = AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance;
}
// Only Focus far
if ( [cameraBack isAutoFocusRangeRestrictionSupported])
{
cameraBack.autoFocusRangeRestriction = AVCaptureAutoFocusRangeRestrictionFar;
}
// Choose best rate depending preset
AVCaptureDeviceFormat *bestFormat = nil;
AVFrameRateRange *bestFrameRateRange = nil;

for ( AVCaptureDeviceFormat *format in [cameraBack formats] )
{
for ( AVFrameRateRange *range in format.videoSupportedFrameRateRanges )
{
if ( range.maxFrameRate > bestFrameRateRange.maxFrameRate )
{
bestFormat = format;
bestFrameRateRange = range;
}
}
}
if (bestFormat)
{
cameraBack.activeFormat = bestFormat;
cameraBack.activeVideoMinFrameDuration = bestFrameRateRange.minFrameDuration;
cameraBack.activeVideoMaxFrameDuration = bestFrameRateRange.maxFrameDuration;
}
[cameraBack unlockForConfiguration];
NSLog(@"unlockForConfiguration!");
}
}

图片: Banding I No Banding I with external light Banding II

最佳答案

遵循 Apple 关于 CIFilter 的文档

Android 和 IOS 在相机参数方面有很大不同。 Android 允许您自定义相机参数以避免出现 strip 。另一方面,在 IOS 中,您需要使用 CIFilter 类。 Android 和 IOS 的工作方向不同。

关于ios5 - 配置 iOS 相机参数以避免在视频预览中出现 strip ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20267006/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com