void Morphining::DoAffineTrsform(IplImage *src,IplImage *dst,vector<Coordinate> coord1,vector<Coordinate> coord2,double T,int type,bool debug)//T:Threshold of SSD's error; { CvMat* Matrix = cvCreateMat(3,3,CV_32FC1); Matrix = GetAffineMatrix(coord1,coord2,debug); //if(SSD(coord1,coord2,Matrix,100)) //{ Vertex = new Coordinate [m_numFeature]; for(int i = 0;i < m_numFeature;i++) { Vertex[i] = coord1[i]; } Graphic FindLine; FindLine.CuttingRegion(coord1,m_numFeature,m,b); AffineTrsform(src,dst,Matrix,type,debug); if(debug) { cvNamedWindow("dst",0); cvShowImage("dst",dst); cvWaitKey(0); } //} cvReleaseMat(&Matrix); }
void Panoramic::DoAffineTrsform(IplImage *src,IplImage *dst,vector<Coordinate> adjustedCoord,vector<Coordinate> adjustCoord)//m_lineT:Threshold of SSD's error; { CvMat* Matrix = cvCreateMat(3,3,CV_32FC1); Matrix = GetAffineMatrix(adjustCoord,adjustedCoord); AffineTransform(src,dst,Matrix); cvReleaseMat(&Matrix); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % P a r s e A f f i n e G e o m e t r y % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ParseAffineGeometry() returns an affine matrix as defined by the geometry % string. % % The format of the ParseAffineGeometry method is: % % MagickStatusType ParseAffineGeometry(const char *geometry, % AffineMatrix *affine_matrix,ExceptionInfo *exception) % % A description of each parameter follows: % % o geometry: The geometry (e.g. 1.0,0.0,0.0,1.0,3.2,1.2). % % o affine_matrix: the affine matrix as defined by the geometry string. % % o exception: return any errors or warnings in this structure. % */ MagickExport MagickStatusType ParseAffineGeometry(const char *geometry, AffineMatrix *affine_matrix,ExceptionInfo *exception) { char token[MaxTextExtent]; const char *p; double determinant; MagickStatusType flags; register ssize_t i; GetAffineMatrix(affine_matrix); flags=NoValue; p=(char *) geometry; for (i=0; (*p != '\0') && (i < 6); i++) { GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); switch (i) { case 0: affine_matrix->sx=StringToDouble(token); break; case 1: affine_matrix->rx=StringToDouble(token); break; case 2: affine_matrix->ry=StringToDouble(token); break; case 3: affine_matrix->sy=StringToDouble(token); break; case 4: affine_matrix->tx=StringToDouble(token); flags|=XValue; break; case 5: affine_matrix->ty=StringToDouble(token); flags|=YValue; break; } } determinant=(affine_matrix->sx*affine_matrix->sy-affine_matrix->rx* affine_matrix->ry); if (fabs(determinant) < MagickEpsilon) (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "InvalidGeometry","`%s'",geometry); return(flags); }