에지검출하기2

2차미분을 이용한 cvLaplace() 함수이용



c++)

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
#include <opencv/cv.h>
#include <opencv/highgui.h>
 
 
void main() {
    IplImage* srcImage = cvLoadImage("D:/study/testimage3.jpg"-1);
    IplImage* edgeImage = cvCreateImage(cvGetSize(srcImage), IPL_DEPTH_8U, 3);
 
 
    //에지(edge) : 밝기가 낮은값에서 높은값으로, 높은값에서 낮은값으로 변화하는 경계에 해당되는 부분
    //cvLaplace(원본이미지, 에지이미지, 커널크기) : 에지검출함수
    cvLaplace(srcImage, edgeImage, 3);
 
 
    cvNamedWindow("source", CV_WINDOW_AUTOSIZE);
    cvNamedWindow("edge", CV_WINDOW_AUTOSIZE);
 
    cvShowImage("source", srcImage);
    cvShowImage("edge", edgeImage);
 
    cvWaitKey(0);
 
    cvReleaseImage(&srcImage);
    cvReleaseImage(&edgeImage);
}
cs



결과



+ Recent posts