|
请帮忙运行下下面的程序:(复制一下就可以)
为什么运行不了??
double x=0.0,y=0.0,x0=0.0,y0=0.0,cc=0.0,ss=0.0,temp1,temp2;
int aa=0,bb=0,rr=0,saveaa=0,savebb=0,saverr=0,savexx0=0,saveyy0=0,saveQ=0;
int pos = ptNumber/3;
int i = 0,off = 0,k = 0,iBaseFlag = 100,jj = 0;
int tt = 0,m=0,n=0;
int firstBase = 5;
int secendBase = (2*firstBase+1);
int aaBase = (R.right+R.left)/2 - firstBase,bbBase = (R.bottom+R.top)/2 -firstBase;
LONG minrr = 0;
minrr = (R.right - R.left)>(R.bottom - R.top)?(R.bottom - R.top):(R.right - R.left);
int memsize = (int)(minrr+2*firstBase) * secendBase *secendBase;
BYTE * lpabr = new BYTE[memsize];
memset(lpabr,0,sizeof(BYTE)*memsize);
int maxcount = -1;
/* 局部hough变换检测圆曲线段的一部分*/
for(k=0;k<ptNumber;k+=pos)
{
for(aa=(int)(R.left+R.right)/2 - firstBase;aa<=(int)(R.left+R.right)/2 + firstBase;aa++)
{
if(aa<0)
continue;
if(aa>ImageWidth)
break;
for(bb=(int)(R.top+R.bottom)/2 -firstBase;bb<=(int)(R.top+R.bottom)/2 + firstBase;bb++)
{
if(bb<0)
continue;
if(bb>ImageHeight)
break;
temp1 = (pt[k].x-aa)*(pt[k].x-aa) + (pt[k].y-bb)*(pt[k].y-bb);
rr = (int)sqrt(temp1);
if(rr>=10&&rr<=(int)(minrr/2) + firstBase)
lpabr[rr*secendBase*secendBase+(aa-aaBase)*secendBase+(bb-bbBase)]++;
}
}
}
for(rr=10;rr<=(int)(minrr/2) + firstBase;rr++)
for(aa=(int)(R.left+R.right)/2 - firstBase;aa<=(int)(R.left+R.right)/2 + firstBase;aa++)
{
if(aa<0)
continue;
if(aa>ImageWidth)
break;
for(bb=(int)(R.top+R.bottom)/2 - firstBase;bb<=(int)(R.top+R.bottom)/2 + firstBase;bb++)
{
if(bb<0)
continue;
if(bb>ImageHeight)
break;
if(maxcount<lpabr[rr*secendBase*secendBase+(aa-aaBase)*secendBase+(bb-bbBase)])
{
maxcount = lpabr[rr*secendBase*secendBase+(aa-aaBase)*secendBase+(bb-bbBase)];
saverr = rr;
saveaa = aa;
savebb = bb;
}
}
}
if(maxcount>=4)
{
//记录保存中心,半经
saverr = rr;
saveaa = aa;
savebb = bb;
} |
|