Programming/Image Processing

[OpenCV] 이진화 소스코드

DevMonster 2014. 1. 7. 17:38

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <opencv/cv.h>
#include <opencv/highgui.h>
 
using namespace std;
using namespace cv;
 
int main(void)
{
    Mat image = imread("circuit/C.jpg",0);//CV_LOAD_IMAGE_GRAYSCALE=0, CV_LOAD_IMAGE_COLOR=1
    if(!image.data) return -1; //Check image
 
    Mat binary;
    threshold(image,binary,100,255,THRESH_OTSU);
    imshow("binary",binary);
    waitKey(0); //Wait for keystroke
    return 0;
}


728x90
반응형