susan角点检测 matlab,OpenCV的susan角点检测

#include

#include

#include

#pragma comment(lib, "cv.lib")

#pragma comment(lib, "cxcore.lib")

#pragma comment(lib, "highgui.lib")

#define max_corners 100

int main( int argc, char** argv )

{

int cornerCount=max_corners;

CvPoint2D32f corners[max_corners];

double qualityLevel = 0.05;

double minDistance = 5;

IplImage *srcImage = 0, *grayImage = 0, *corners1 = 0, *corners2 = 0;

int i;

CvScalar color = CV_RGB(255,0,0);

cvNamedWindow( "image", 2); //创建显示窗口

//加载一副图片

srcImage = cvLoadImage("test.png", 1);

grayImage = cvCreateImage(cvGetSize(srcImage), IPL_DEPTH_8U, 1);

//将原图灰度化

cvCvtColor(srcImage, grayImage, CV_BGR2GRAY);

corners1= cvCreateImage(cvGetSize(srcImage), IPL_DEPTH_32F, 1);

corners2= cvCreateImage(cvGetSize(srcImage),IPL_DEPTH_32F, 1);

cvGoodFeaturesToTrack (grayImage, corners1, corners2, corners,&cornerCount, qualityLevel, minDistance, 0);

printf("num corners found: %d\n", cornerCount);

if(cornerCount>0)

{

for (i = 0; i < cornerCount; ++i)

{

cvCircle(srcImage, cvPoint((int)(corners[i].x), (int)(corners[i].y)), 6, color, 2, CV_AA, 0);

}

}

cvShowImage("image", srcImage);

cvWaitKey(0);

cvReleaseImage(&srcImage);

cvReleaseImage(&grayImage);

cvReleaseImage(&corners1);

cvReleaseImage(&corners2);

return 0;

}

susan角点检测 matlab,OpenCV的susan角点检测_第1张图片

// eyes_susan.cpp : 定义控制台应用程序的入口点。//可以检测眼睛动态匹配轮廓的susan角点检测算法,准确率98#include#include#include#include "cv.h"#include "highgui.h"#pragma comment(lib, "cv.lib")#pragma comment(lib, "cxcore.lib")#pragma comment(lib, "highgui.lib")int main( int argc, char** argv ){int height ,width ,step ,channels ;int i,j,k,same ,max,min,sum;float thresh;uchar *data0,*data1 ;//char *filename="result.bmp";IplImage* Img, *nimg; //声明IplImage指针//载入图像Img = cvLoadImage( "test.png",0);cvNamedWindow( "Image0", 2); //创建窗口cvShowImage( "Image0", Img ); //显示图像nimg = cvCreateImage(cvGetSize(Img),8,1);height = Img->height;width = Img->width;step = Img->widthStep/sizeof(uchar);channels = Img->nChannels;data0 = (uchar*)Img->imageData;data1 = (uchar*)nimg->imageData;printf("Processing a %d X %d image with %d channels\n",width,height,channels);int OffSetX[37] = { -1, 0, 1,-2,-1, 0, 1, 2,-3,-2,-1, 0, 1, 2, 3,-3,-2,-1, 0, 1, 2, 3,-3,-2,-1, 0, 1, 2, 3,-2,-1, 0, 1, 2,-1, 0, 1 };int OffSetY[37] = { -3,-3,-3,-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,-1,-1,0, 0, 0, 0, 0, 0, 0,1, 1, 1, 1, 1, 1, 1,2, 2, 2, 2, 2,3, 3, 3 };max = min = data0[0];for(i=3;iimageData[i*step+j] = 255;elsenimg->imageData[i*step+j] = 0;printf("same = %d\n", same);}cvNamedWindow( "Image", 2); //创建窗口cvShowImage( "Image", nimg ); //显示图像cvWaitKey(0); //等待按键cvDestroyWindow( "Image" );//销毁窗口cvReleaseImage( &Img ); //释放图像cvReleaseImage( &nimg );return 0;}

susan角点检测 matlab,OpenCV的susan角点检测_第2张图片

你可能感兴趣的:(susan角点检测,matlab)