Canny Edge - OpenCV Sample Code(example source)

// Origin Image
IplImage *pImage = cvLoadImage(“-”);

// Gray Image
IplImage *pGray = cvCreateImage( cvGetSize(pImage), IPL_DEPTH_8U, 1 );

// RGB to Gray
cvCvtColor(pImage, pGray, CV_RGB2GRAY);

// Edge Image
IplImage *pEdge = cvCreateImage( cvGetSize(pImage), IPL_DEPTH_8U, 1 );

// Canny Function
//Th1 is maximum value to Start tracking edge point
//If pixel point value is bigger than Th1, Edge connecting is started.

//Th2 is minimum value to stop tracking edge point
//If pixel point value is smaller than Th2, Edge connecting is ended.

cvCanny( pGray, pEdge, th1, th2 );

th1 = 10, th2=100

th1=200, th2=100










Comments

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write