void CUIDemoDlg::TukeyWindow(OutputArray out,int n,float r)
{
Mat w;
w = Mat::zeros(n,1, CV_32F);
float per = r/2;
int tl = (int)(per*(n-1))+1;
int th = n-tl+1;
float tempw;
int i;
for(i = 0; i<tl;i++)
{
tempw =(float)( (1-cos(10*CV_PI*i/(n+8)))/2 );
w.ptr<float>(i)[0] =tempw;
}
for( ; i<th;i++)
{
tempw = 1;
w.ptr<float>(i)[0] =tempw;
}
for( ; i<n;i++)
{
tempw = (float)( (1-cos(10*CV_PI*(n-i-1)/(n+8)))/2 );
w.ptr<float>(i)[0] =tempw;
}
w.copyTo(out);
}
{
Mat w;
w = Mat::zeros(n,1, CV_32F);
float per = r/2;
int tl = (int)(per*(n-1))+1;
int th = n-tl+1;
float tempw;
int i;
for(i = 0; i<tl;i++)
{
tempw =(float)( (1-cos(10*CV_PI*i/(n+8)))/2 );
w.ptr<float>(i)[0] =tempw;
}
for( ; i<th;i++)
{
tempw = 1;
w.ptr<float>(i)[0] =tempw;
}
for( ; i<n;i++)
{
tempw = (float)( (1-cos(10*CV_PI*(n-i-1)/(n+8)))/2 );
w.ptr<float>(i)[0] =tempw;
}
w.copyTo(out);
}