threshold
通常用来筛选符合有个值域内的信息
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat src = imread("D:/Teach_turials/learnopencv/Threshold/threshold.jpg",0);
imshow("0", src);
Mat dst;
threshold(src, dst, 0, 255, THRESH_BINARY);
imwrite("opencv_threshold-example.jpg", dst);
threshold(src, dst, 0, 128, THRESH_BINARY);
imwrite("opencv_thresh_binary-maxval.jpg",dst);
threshold(src, dst, 127, 255, THRESH_BINARY);
imwrite("opencv_thresh-binary.jpg", dst);
threshold(src, dst, 127, 255, THRESH_BINARY_INV);
imwrite("opencv_thresh-binary-inv.jpg", dst);
threshold(src, dst, 127, 255, THRESH_TRUNC);
imwrite("opencv_thresh-trunc.jpg", dst);
threshold(src, dst, 127, 255, THRESH_TOZERO);
imwrite("opencv_thresh-tozero.jpg", dst);
threshold(src, dst, 127, 255, THRESH_TOZERO_INV);
imwrite("opencv_thresh-to-zero-inv.jpg", dst);
}
windows中,绝对路径用/表示
windows中,绝对路径用/表示 windows中,绝对路径用/表示