我怎样才能解决'语义问题'

时间:2013-02-26 14:21:33

标签: objective-c xcode opencv

我已下载模板here

我有XCode 4.6当我运行它时,我得到以下内容:

 + (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat orientation:(UIImageOrientation)orientation
{
    return [[UIImage alloc] initWithCVMat:cvMat orientation:orientation];
}

+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat
{
    return [[UIImage alloc] initWithCVMat:cvMat orientation:0];
}

我收到了错误

Cannot initialize a parameter of type 'UIImageOrientation' with an value of type 'int'

我该如何解决?也许有人知道

2 个答案:

答案 0 :(得分:1)

错误是关于在第二种便捷方法中使用0

选择没有给出时的默认方向

+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat {
     return [[UIImage alloc] initWithCVMat:cvMat orientation:UIImageOrientationUp]; 
}

答案 1 :(得分:0)

这种方法

+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat
{
return [[UIImage alloc] initWithCVMat:cvMat orientation:0];
}

你不能拥有orientation:0,因为它需要UIImageOrientation类型的对象。也许尝试使它nil(不确定是否允许)或给它一个新的默认UIImageOrientation

相关问题