作者:
出处:#include#include "cv.h"#include "highgui.h"#define MAX_CORNERS 100int main(void){int cornersCount=MAX_CORNERS;//得到的角点数目CvPoint2D32f corners[MAX_CORNERS];//输出角点集合IplImage *srcImage = 0,*grayImage = 0,*corners1 = 0,*corners2 = 0;int i;CvScalar color = CV_RGB(255,0,0);char *filename = "pic3.png";cvNamedWindow("image",1);//Load the image to be processedsrcImage = cvLoadImage(filename,1);grayImage = cvCreateImage(cvGetSize(srcImage),IPL_DEPTH_8U,1);//copy the source image to copy image after converting the format//复制并转为灰度图像cvCvtColor(srcImage,grayImage,CV_BGR2GRAY);//create empty images os same size as the copied images//两幅临时32位浮点图像,cvGoodFeaturesToTrack会用到corners1 = cvCreateImage(cvGetSize(srcImage),IPL_DEPTH_32F,1);corners2 = cvCreateImage(cvGetSize(srcImage),IPL_DEPTH_32F,1);cvGoodFeaturesToTrack(grayImage,corners1,corners2,corners,&cornersCount,0.05,30,//角点的最小距离是300,//整个图像3,0,0.4);//默认值printf("num corners found: %d/n",cornersCount);//开始画出每个点if (cornersCount>0){for (i=0;i
作者:
出处: