轮子效果

bool __fastcall TCbwAnimationEffect_Wheel::BuildMaskMat(cv::Mat& destMat,

    cv::Mat& srcMat, TRect displayRect) {

    TRect wholeRect(0, 0, displayRect.right - displayRect.left,

        displayRect.bottom - displayRect.top);

    double cx = wholeRect.right / 2.0, cy = wholeRect.bottom / 2.0;

    TCbwFloatPoint centerPoint(cx, cy);

    double unitDegree = 360 / FPattern;

    double deltaDegree = double(FCurrentIndex + 1) / FTotalFramesInOnePeriod * unitDegree;

    BYTE * pDst = destMat.data;

    for (int row = 0; row < destMat.rows; ++row)

        for (int col = 0; col < destMat.cols; ++col) {

            TCbwFloatPoint p(col, row);

            double theta = p.ThetaToPoint(centerPoint);

            if (FClockwiseFlag)

                theta = 360 - theta;

            bool inFlag = false;

            for (int i = 0; i < FPattern; ++i) {

                if (theta >= unitDegree * i && (theta - unitDegree * i) <=

                    deltaDegree)

                    inFlag = true;

            }

            *pDst++ = inFlag ? 255 : 0;

        }

    return true;

}

 

演示效果

基于OpenCV的视频图像组态 (7) :轮子动画效果

相关文章:

  • 2021-12-15
  • 2021-08-30
  • 2022-01-05
  • 2021-08-16
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
  • 2023-02-02
猜你喜欢
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2021-06-27
相关资源
相似解决方案