OpenCV
edge detection(sobel)
김연호님
2016. 4. 9. 18:23
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
using namespace std;
int main(void)
{
// Original Image
Mat image = imread("C:/Users/Administrator/Desktop/pop.png", CV_LOAD_IMAGE_COLOR);
imshow("Original image", image);
// Original Image to Gray Image
Mat gray;
cvtColor(image, gray, CV_BGR2GRAY);
// Sobel Filter
Mat sobel;
Mat sobelX;
Mat sobelY;
Sobel(gray, sobelX, CV_8U, 1, 0);
Sobel(gray, sobelY, CV_8U, 0, 1);
sobel = abs(sobelX) + abs(sobelY);
// Result Image
imshow("image", sobel);
waitKey(0);
return 0;
}