:13.982KB : :1 :2022-08-28 22:34:39
Opencv3中SIFT算法详解如果开发者对于本文件有需要的可以参考。
整理SIFT算法,带详细注释!
tatic void mycalcSIFTDescriptor(const Mat& img, Point2f ptf, float ori, float scl,
int d, int n, float* dst)
{ //d=4 n=8
//计算余弦,正弦,CV_PI/180:将角度值转化为幅度值
Point pt(cvRound(ptf.x), cvRound(ptf.y));
float cos_t = cosf(ori*(float)(CV_PI / 180));
float sin_t = sinf(ori*(float)(CV_PI / 180));
float bins_per_rad = n / 360.f;//45°
float exp_scale = -1.f / (d * d * 0.5f);
float hist_width = mySIFT_DESCR_SCL_FCTR * scl;
// 计算图像区域半径mσ(d 1)/2*sqrt(2)
// 1.4142135623730951f 为根号2
int radius = cvRound(hist_width * 1.4142135623730951f * (d 1) * 0.5f);
// Clip the radius to the diagonal of the image to avoid autobuffer too large exception
radius = std::min(radius, (int)sqrt(((double)img.cols)*img.cols ((double)img.rows)*img.rows));
cos_t /= hist_width;
sin_t /= hist_width;
int i, j, k, len = (radius * 2 1)*(radius * 2 1), histlen = (d 2)*(d 2)*(n 2);
int rows = img.rows, cols = img.cols;
AutoBuffer
float *X = buf, *Y = X len, *Mag = Y, *Ori = Mag len, *W = Ori len;
float *RBin = W len, *CBin = RBin len, *hist = CBin len;
10-17STM32芯片CAN详解
10-12H5和WebGL 3D开发实战详解
10-12Linux设备驱动开发详解
10-05qt qmake详解
10-02AXI总线中文详解.doc
10-02C++多线程编程入门及范例详解.pdf
10-04excel自动更正功能使用方法详解
10-03excel实现多条件排序功能详解
08-31excel修改行高两种方法详解
08-30Excel斜表头做法详解
08-28word设置行距方法详解
11-26excel统计函数countif功能详解
11-16word如何录制宏方法详解