OpenCV threshold with mask
In general, you can simply compute the threshold using cv::threshold, and then copy the src image on dst using the inverted mask. // Apply cv::threshold on all image thresh = cv::threshold(src, dst, thresh, maxval, type); // Copy original image on inverted mask src.copyTo(dst, ~mask); With THRESH_OTSU, however, you also need to compute the threshold value … Read more