找回密码
 注册
搜索
查看: 521|回复: 0

[讨论] 求助高手

[复制链接]
发表于 2008-5-7 09:22:07 | 显示全部楼层 |阅读模式
请帮忙运行下下面的程序:(复制一下就可以)
为什么运行不了??
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;
}
高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-11-27 14:50 , Processed in 0.045297 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表