zoukankan      html  css  js  c++  java
  • 基于OpenCV的视频图像组态 (7) :轮子动画效果

    轮子效果

    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;

    }

    演示效果

  • 相关阅读:
    C# 中的var关键字
    sql中去掉换行符和回车符
    Linq之旅:Linq入门详解(Linq to Objects)
    c# for 和 foreach
    c# Dictionary
    ASP.NET Web.config学习
    c# 装箱与拆箱的概念
    c# List集合学习
    Index was out of range
    C# double保留四位小数
  • 原文地址:https://www.cnblogs.com/drgraph/p/8006206.html
Copyright © 2011-2022 走看看