基于OpenCV的视频图像组态 (7) :轮子动画效果
2017-12-08 17:04
337 查看
轮子效果
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;
}
演示效果
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) :轮子动画效果
- 基于OpenCV的视频图像组态 (6): 形状动画效果
- 基于OpenCV的视频图像组态 (8) :随机线条动画效果
- 基于OpenCV的视频图像组态 (8) :随机线条动画效果
- 基于OpenCV的视频图像组态 (5) :擦除动画效果
- 基于OpenCV的视频图像组态 (12): 翻转式由远到近动画效果
- 基于OpenCV的视频图像组态 (4) :劈裂动画效果
- 基于OpenCV的视频图像组态 (5) :擦除动画效果
- 基于OpenCV的视频图像组态 (12): 翻转式由远到近动画效果
- 基于OpenCV的视频图像组态 (4) :劈裂动画效果
- 基于OpenCV的视频图像组态 (6): 形状动画效果
- 基于OpenCV的视频图像组态 (3):常见PPT动画1
- 基于OpenCV的视频图像组态 (3):常见PPT动画1
- 基于OpenCV的视频图像组态 (2) :动画总体
- 基于OpenCV的视频图像组态 (2) :动画总体
- 基于OpenCV的视频图像组态 (9):CEF浏览器初步
- 基于OpenCV的视频图像组态 (13):VLC Player解码帧数据
- 基于OpenCV的视频图像组态 (10): CEF浏览器与图形软件互嵌
- 基于OpenCV的视频图像组态 (11): CEF浏览器与C++通信
- 基于OpenCV的视频图像组态 (11): CEF浏览器与C++通信