15. if(!feat)
16. fatal_error("NULLpointererror,%s,line%d",__FILE__,__LINE__);
17.
18. /*buildscalespacepyramid;smallestdimensionoftoplevelis~4pixels
*/
19. /*构建高斯尺度空间金字塔,顶层最小的为 4 像素 */
20. init_img=create_init_img(img,img_dbl,sigma);
21. octvs=log(doubleMIN(init_img->width,init_img->height))/log(2.0)
-2;
22. //构建高斯金字塔和高斯差分金字塔
23. gauss_pyr=build_gauss_pyr(init_img,octvs,intvls,sigma);
24. dog_pyr=build_dog_pyr(gauss_pyr,octvs,intvls);
25.
26. storage=cvCreateMemStorage(0);
27.
28. //尺度空间极值点检测
29. features=scale_space_extrema(dog_pyr,octvs,intvls,contr_thr,
30. curv_thr,storage);
31.
32. //画出去除低对比度的极值点
33. //draw_extrempoint(img,features);
34.
35.
36.
37.
38. //计算特征向量的尺度
39. calc_feature_scales(features,sigma,intvls);
40. if(img_dbl)
41. adjust_for_img_dbl(features);
42. //计算特征的方向
43. calc_feature_oris(features,gauss_pyr);
44. //计算描述子,包括计算二维方向直方图和转换其为特征描述子
45. compute_descriptors(features,gauss_pyr,descr_width,descr_hist_bins);
46.
47. /*sortfeaturesbydecreasingscaleandmovefromCvSeqtoarray*/
48. cvSeqSort(features,(CvCmpFunc)feature_cmp,NULL);
49. n=features->total;
50. *feat=static_cast<feature*>(calloc(n,sizeof(structfeature)));
51. *feat=static_cast<feature*>(cvCvtSeqToArray(features,*feat,CV_WHOLE
_SEQ));
52.
53.
54.