Opencv iOS type

后端 未结 1 2022
醉酒成梦
醉酒成梦 2021-01-26 01:59

Im trying to create methods to convert UIImage to Mat and vice versa, but an \"Expected a type\" error keeps popping up for (cv::Mat) when I try to build. When I clean my projec

相关标签:
1条回答
  • 2021-01-26 02:29

    OpenCV provides functions for doing these conversions for you:

    #import <opencv2/imgcodecs/ios.h>
    
    - (cv::Mat)matWithImage:(UIImage *)image {
        MAT dst;
        UIImageToMat(image, dst);
        return dst;
    }
    
    - (UIImage *)imageWithCVMat:(cv::Mat)source {
        return MatToUIImage(source);
    }
    
    0 讨论(0)
提交回复
热议问题