/// /// 开始动画 ///@param[in] iX, iY 座标 ///@return void void CWndAnimate::BeginAnimate(int iX, int iY, int iWidth, int iHeight, int nRound, int iFlip,bool IsLoop) { if (GetIsPlaying()) { return; } if (NULL == m_pParent) { return; } if (m_nFrameCount<=0) { return; } m_nPos = 0; m_nTime = 0; m_nTotalRound = nRound; m_iX = iX; m_iY = iY; m_iWidth = iWidth; m_iHeight = iHeight; if (iFlip != 100) { for (int i=0; i<m_nFrameCount; i++) { m_iFlip[i] = iFlip; } } m_IsLoop = IsLoop; if (0 == m_iWidth) { m_iWidth = m_FrameList[0].GetWidth(); } if (0 == m_iHeight) { m_iHeight = m_FrameList[0].GetHeight(); } CPoint ptDst(m_iX, m_iY); m_pParent->ClientToScreen(&ptDst); MoveWindow(ptDst.x, ptDst.y, m_iWidth, m_iHeight); m_bPlaying = true; SetTimer(TIME_FRAME, m_iFlip[0], NULL); SetTimer(TIME_RENDER, 5, NULL); SetWindowPos(m_pParent,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); }
/** Method to register two images using the simple pairwise algorithm without allocating memory @param srcIm: Source Image @param dstIm: Destination image @param Covar: CvMat Not used @param pInterframePoorFlag: Detection Flag @param pA: Not Used @param pB: Not Used @return void */ void InterframeRegister::Register( Mat srcIm, Mat dstIm, Mat &pTransform, Mat pCovar, bool pInterframePoorFlag) { /* init transform to identity */ setIdentity(pTransform); /* image params */ const Size szCurr = srcIm.size(); /* registration parameters */ double bound[2][2] = {0.0}; double transform[3][3] = {0.0}; vector <Point2f> ptSrc (InterframeRegister::MAX_KLT_POINTS); /* Contrast stretch */ Mat srcStretch = srcIm.clone(); Mat dstStretch = dstIm.clone(); cvutStdDevStretch( srcStretch , srcStretch ); cvutStdDevStretch( dstStretch , dstStretch ); //////////////////////////////////////////////////////// /* KLT ONLY. NO SWITCHING TO INTENSITY-BASED */ int cornerCount = InterframeRegister::InitFeatures(srcStretch, ptSrc); vector <Point2f> ptDst (cornerCount); /* sanity check for sufficiency */ if(cornerCount < InterframeRegister::INLIER_THRESH) { if(pInterframePoorFlag != NULL) pInterframePoorFlag = true; return; } /* find matching points */ cornerCount = TrackFeatures(srcStretch, dstStretch, ptSrc, ptDst, cornerCount); /* Robust estimation of motion parameters */ vector <Point2d> optInliersL (cornerCount); /* dst */ vector <Point2d> optInliersR (cornerCount); /* src */ pTransform = RunRansac(ptDst, ptSrc, cornerCount, optInliersL, optInliersR, srcIm, dstIm); }