AVCapture中实现拉近拉远镜头
2013-12-24 18:59
791 查看
这段代码在我机器上运行貌似一直出错,我后来是这样写的:
//写了这几句话 貌似远点了 1224日
[self.captureSession
beginConfiguration];
self.device.videoZoomFactor =
50.0f;
AVCaptureStillImageOutput* output = (AVCaptureStillImageOutput*)[self.captureSession.outputs
objectAtIndex:0];
AVCaptureConnection *videoConnection = [output
connectionWithMediaType:AVMediaTypeVideo];
CGFloat maxScale = videoConnection.videoMaxScaleAndCropFactor;
CGFloat zoom = maxScale /
50;
// videoConnection.videoScaleAndCropFactor -= zoom;
videoConnection.videoScaleAndCropFactor =
1.0f;
[self.captureSession
commitConfiguration];
转载自:http://blog.csdn.net/song_yu_tao/article/details/17305601
自己用avcapture实现自定制相机,系统相机是可以拉近拉远镜头的,网上搜寻了半天始终没有发现,刚才又翻看了半天的api接口,终于找到了,原来他藏在AVCaptureConnection中,videoScaleAndCropFactor:缩放裁剪系数。简单写了下使用方法:
[objc] view
plaincopy
AVCaptureStillImageOutput* output = (AVCaptureStillImageOutput*)[self.captureSession.outputs objectAtIndex:0];
AVCaptureConnection *videoConnection = [output connectionWithMediaType:AVMediaTypeVideo];
CGFloat maxScale = videoConnection.videoMaxScaleAndCropFactor;
CGFloat zoom = maxScale / 50;
videoConnection.videoScaleAndCropFactor += zoom;
self.preVideoView.transform = CGAffineTransformScale(self.preVideoView.transform, zoom, zoom);
其中preVideoView的layer中添加了AVCaptureVideoPreviewLayer。
//写了这几句话 貌似远点了 1224日
[self.captureSession
beginConfiguration];
self.device.videoZoomFactor =
50.0f;
AVCaptureStillImageOutput* output = (AVCaptureStillImageOutput*)[self.captureSession.outputs
objectAtIndex:0];
AVCaptureConnection *videoConnection = [output
connectionWithMediaType:AVMediaTypeVideo];
CGFloat maxScale = videoConnection.videoMaxScaleAndCropFactor;
CGFloat zoom = maxScale /
50;
// videoConnection.videoScaleAndCropFactor -= zoom;
videoConnection.videoScaleAndCropFactor =
1.0f;
[self.captureSession
commitConfiguration];
转载自:http://blog.csdn.net/song_yu_tao/article/details/17305601
自己用avcapture实现自定制相机,系统相机是可以拉近拉远镜头的,网上搜寻了半天始终没有发现,刚才又翻看了半天的api接口,终于找到了,原来他藏在AVCaptureConnection中,videoScaleAndCropFactor:缩放裁剪系数。简单写了下使用方法:
[objc] view
plaincopy
AVCaptureStillImageOutput* output = (AVCaptureStillImageOutput*)[self.captureSession.outputs objectAtIndex:0];
AVCaptureConnection *videoConnection = [output connectionWithMediaType:AVMediaTypeVideo];
CGFloat maxScale = videoConnection.videoMaxScaleAndCropFactor;
CGFloat zoom = maxScale / 50;
videoConnection.videoScaleAndCropFactor += zoom;
self.preVideoView.transform = CGAffineTransformScale(self.preVideoView.transform, zoom, zoom);
其中preVideoView的layer中添加了AVCaptureVideoPreviewLayer。
相关文章推荐
- AVCapture中实现拉近拉远镜头
- AVCaptureDevice中通过调用VideoZoomFactor方法调整焦距实现拉近拉远镜头进行拍照录制视频(动画缩放画面,不闪屏)
- AVfoundation中焦距的设置(slider实现拉近拉远镜头) -自定义UISlider
- unity3D鼠标滚轮来实现镜头拉近拉远及视角旋转
- AVfoundation中焦距的设置(slider实现拉近拉远镜头)
- AVCapture中实现拉近拉远镜头
- iOS 扫描二维码实现手势拉近拉远镜头
- 镜头的由远到近的镜头拉近效果实现
- 游戏开场镜头拉近(Unity3D开发之四)
- Unity随机镜头切换,可旋转,可拉近拉远
- unity3d 带缓冲的镜头拉近效果
- AVFoundation/AVCaptureSession实现自定义相机界面拍照(四)
- unity3d 带缓冲的镜头拉近效果
- unity3d 带缓冲的镜头拉近效果
- 3d游戏中剧情开启扭转镜头的实现
- swift4 扫描框聚焦和拉近镜头
- AngryBird简单开发实现(二),zoom in/out的实现以及镜头跟随效果
- Ue4 BluePrint蓝图实现镜头(视角)切换及摆动范围(一)
- 几种简单常用的镜头边缘检测算法(matlab实现)
- 几种简单常用的镜头边缘检测算法(matlab实现)