OpenCV - How to apply adaptive threshold to an image on iOS

前端 未结 2 1106
生来不讨喜
生来不讨喜 2021-02-13 17:34

I am trying to apply adaptive thresholding to an image of an A4 paper as shown below:

I use the c

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-13 18:08

    Try this:

    + (UIImage *)processImageWithOpenCV:(UIImage*)inputImage {
        cv::Mat cvImage = [inputImage CVMat];
        threshold(cvImage, cvImage, 128, 255, cv::THRESH_BINARY);
        return [UIImage imageWithCVMat:cvImage];
    }
    

    Result image:

提交回复
热议问题