作者热门文章
- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我的 CvVideoCamera
会自动旋转,但我不希望它这样做。 This has been raised on the bugtracker , 但是有一段时间没有事件了。
最佳答案
子类CvVideoCamera
,只删除旋转代码。我希望我的方向始终是纵向的,所以这很简单:
#import <opencv2/highgui/cap_ios.h>
@interface MyCvVideoCamera : CvVideoCamera
- (void)updateOrientation;
- (void)layoutPreviewLayer;
@property (nonatomic, retain) CALayer *customPreviewLayer;
@end
#import "MyCvVideoCamera.h"
@implementation MyCvVideoCamera
- (void)updateOrientation;
{
// nop
}
- (void)layoutPreviewLayer;
{
if (self.parentView != nil) {
CALayer* layer = self.customPreviewLayer;
CGRect bounds = self.customPreviewLayer.bounds;
layer.position = CGPointMake(self.parentView.frame.size.width/2., self.parentView.frame.size.height/2.);
layer.bounds = bounds;
}
}
@end
关于ios - 如何让 CvVideoCamera 不自动旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14876895/
我是一名优秀的程序员,十分优秀!