Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
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
Tags
more
Archives
Today
Total
관리 메뉴

저장소

edge detection(sobel) 본문

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;

}

'OpenCV' 카테고리의 다른 글

영상반전  (0) 2016.04.10
이미지 띄우기  (0) 2016.04.09
edge detection(canny)  (0) 2016.04.09
이미지 회전  (0) 2016.04.08
템플릿 매칭  (0) 2016.03.04
Comments