Programming/Image Processing

[OpenCV] Edge Detection(Canny Filter) 사용하기 예제

DevMonster 2014. 1. 10. 02:28

[원본 이미지]


[Source code]

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
#include <opencv\cv.h>
#include <opencv\highgui.h>
 
using namespace cv;
using namespace std;
 
int main(void)
{
    // Original Image
    Mat image =    imread("circuit/c.jpg", CV_LOAD_IMAGE_COLOR);
    imshow("Original image", image);
 
    // Original Image to Gray Image
    Mat gray;
    cvtColor(image, gray, CV_BGR2GRAY);
 
    // Canny Filter
    Mat canny;
    Canny(gray, canny, 100, 150);
 
    // Result Image
    imshow("image", canny);
 
    waitKey(0);                                        
    return 0;
}

[Result Image]






728x90
반응형