代码拉取完成,页面将自动刷新
/**
* OpenCV Threshold Example
*
* Copyright 2015 by Satya Mallick <spmallick@gmail.com>
*
**/
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
// Read image
Mat src = imread("threshold.png", IMREAD_GRAYSCALE);
Mat dst;
// Basic threhold example
threshold(src,dst,0, 255, THRESH_BINARY);
imwrite("opencv-threshold-example.jpg", dst);
// Thresholding with maxval set to 128
threshold(src, dst, 0, 128, THRESH_BINARY);
imwrite("opencv-thresh-binary-maxval.jpg", dst);
// Thresholding with threshold value set 127
threshold(src,dst,127,255, THRESH_BINARY);
imwrite("opencv-thresh-binary.jpg", dst);
// Thresholding using THRESH_BINARY_INV
threshold(src,dst,127,255, THRESH_BINARY_INV);
imwrite("opencv-thresh-binary-inv.jpg", dst);
// Thresholding using THRESH_TRUNC
threshold(src,dst,127,255, THRESH_TRUNC);
imwrite("opencv-thresh-trunc.jpg", dst);
// Thresholding using THRESH_TOZERO
threshold(src,dst,127,255, THRESH_TOZERO);
imwrite("opencv-thresh-tozero.jpg", dst);
// Thresholding using THRESH_TOZERO_INV
threshold(src,dst,127,255, THRESH_TOZERO_INV);
imwrite("opencv-thresh-to-zero-inv.jpg", dst);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。