-
Notifications
You must be signed in to change notification settings - Fork 0
/
thresholding.cpp
39 lines (27 loc) · 937 Bytes
/
thresholding.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#include "iostream"
#include <opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include "opencv2/imgproc/imgproc.hpp"
using namespace std;
using namespace cv;
int main() {
Mat src, src_gray, dst;
src = imread("C:/Users/sumaira/mscs/Documents/Visual Studio 2015/Projects/COMPUTER VISION USING OPENCV/assignment 2 bayes classifier/assignment 2 bayes classifier/Clase1.JPG");
if (!src.data) {
cout << "image is empty";
exit(1);
}
cvtColor(src,src_gray, CV_BGR2GRAY);
//threshold(src_gray, dst, 150, 255, THRESH_TOZERO_INV);
//threshold(src_gray, dst, 50, 255, THRESH_BINARY);
//threshold(src_gray, dst, 150, 255, THRESH_TOZERO);
//threshold(src_gray, dst, 50, 255, THRESH_TRUNC);
threshold(src_gray, dst, 50, 255,THRESH_BINARY_INV);
namedWindow("src", CV_WINDOW_AUTOSIZE);
imshow("src", src);
namedWindow("dst", CV_WINDOW_AUTOSIZE);
imshow("dst", dst);
waitKey(0);
return (0);
}