如何在OpenCV中获取Freeman链代码? 我正在尝试使用FindCountours函数获得Freeman链代码,但我无法理解其参数,并且在OpenCV Documenta中没有给出每个参数的解释...

问题描述 投票:0回答:2
有人可以帮助我吗?

	
通过此功能,您将从Freeman Chain获得轮廓。它不会给您弗里曼链,它将其作为输入。 我不知道为什么在OpenCV的当前版本中没有CV :: Chain_code(它等于0),但我已经检查了

vector<vector<cv::Point>> c; cv::findContours(Img,c,RETR_EXTERNAL,0 );

工作好。并给出全弗雷曼的轮廓代码。
c++ opencv
2个回答
1
投票

CvChain* chain=0; CvMemStorage* storage=0; storage=cvCreateMemStorage(0); cvFindContours( &IplImage(Img), storage, (CvSeq**)(&chain), sizeof(*chain), CV_RETR_EXTERNAL, CV_CHAIN_CODE ); for(;chain!=NULL;chain=(CvChain*)chain ->h_next) { //chain=(CvChain*)chain ->h_next; //if(chain==NULL){break;} CvSeqReader reader; int i, total = chain->total; cvStartReadSeq((CvSeq*)chain,&reader,0); printf("--------------------chain\n"); for(i=0;i<total;i++) { char code; CV_READ_SEQ_ELEM(code, reader); printf("%d",code); } }

/ * *程序以找到freeman(wittaya)配对的椭圆形曲线与嵌入度k = 10 * * * * * * * * * * *曲线到文件freeman.dat * * Mike Scott 6/10/2005 * */#include #include #include #include #include #include #include #include #include“ big.h”使用名称空间std;  //解决pell equation int pell(int max,big d,big f,big&x,big&y,big *sx,big *sy,bool&complete){int i,j,ns;     布尔小;     Big A,P,Q,SD,G,B,OG,OB,NG,NB,T;      完整= false;     smalld = false;     如果(d

max)返回ns; //流产 - 这些仅是解决方案t = g*g*g -d*b*b; if(t == f/4){sx [ns] = 2*g; sy [ns] = 2*b; NS ++; } if(t == f){sx [ns] = g; sy [ns] = b; NS ++; } if(i> 0 && q == 1)休息; } if(i%2 == 1)(j = 0;j

max)返回ns; t = g*g-d*b*b; if(t == f/4){sx [ns] = 2*g; sy [ns] = 2*b; NS ++; } if(t == f){sx [ns] = g; sy [ns] = b; NS ++; }}完整= true; //我们到达了末尾.... x = g; y = b; // x^2 -dy^2 = 1 //的最小解决方案可用于找到更多解决方案。...如果(SmallD){//太小 - 这样做很难的大Ylim1,Ylim2,r; NS = 0; if(f

300){cout

primes[i]; if(((d%(s*s))== 0)返回false; if(((s*s)> d)休息; }返回true; } void结果(bool fout,ofstream&ofile,int d,big p,big p,big cf,big ord){cout
512)break;                 if(((x-5)%15 == 0){x =(x-5)/15;                     p = 25*x*x*x*x+25*x*x*x+25*x*x+10*x+3;                  if(bit(p)> 148){if(prime(p)){nrp = 25*x*x*x*x*x+25*x*x*x*x+15*x*x*x+5*x+1;                             ord = trial_divide(nrp);                          if(prime(ord)&& bits(ord)> 148)结果(fout,ofile,d,p,p,nrp/ord,ord,ord);                        }}} if(( -  x-5)%15 == 0){x =( -  x-5)/15;                    p = 25*x*x*x*x+25*x*x*x+25*x*x+10*x+3;                  if(bit(p)> 148){if(prime(p)){nrp = 25*x*x*x*x*x+25*x*x*x*x+15*x*x*x+5*x+1;                             ord = trial_divide(nrp);                          if(prime(ord)&& bits(ord)> 148)结果(fout,ofile,d,p,p,nrp/ord,ord,ord);                        }}} if(!完成)休息;  //没有更多的解决方案乘以(TD,T0,U0,X,Y);             }}}返回0; }

0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.