[OpenCV #3]Threshold

OpenCV/example 2013. 2. 14. 19:09

1.Threshold

2.Project.cpp

#include <opencv2/core/core.hpp>

#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main()
{
     Mat image = imread("sistar.jpg"); //Load image form disk
     if(!image.data) return -1; //Check image
     //Split the original image into three channels
     //channels[0],channels[1],channels[2]
     vector<Mat> channels;
     split(image, channels);

Mat image2;
threshold(channels[0], image2, 100, 255, CV_THRESH_BINARY);
imshow("Threadholded", image2);
waitKey(0); //Wait for keystroke
return 0;

}


반응형