基于FPGA的Alpha半透明图像叠加算法实现
来源:互联网 发布:黑客编程新手教学 编辑:程序博客网 时间:2024/05/16 17:05
#include<opencv2\opencv.hpp>#include<iostream>using namespace cv;using namespace std;Mat dealImg(Mat &img);int main() {Mat img = imread("E://ͼƬ//1.png");if (img.empty()) {return -1;}Mat result;result = dealImg(img);waitKey(0);destroyAllWindows;return 0;}Mat dealImg(Mat & img){Mat temp;Mat img1 = imread("E://ͼƬ//5.jpg");if (img1.empty()) {return Mat();}img.convertTo(temp, CV_32F);Mat img2(temp.size(), img1.type());resize(img1, img2, temp.size());img2.convertTo(img2, CV_32F);Mat result = temp.clone();float alpha = 0.35; //调整透光for (int i = 0; i < temp.rows; i++) {float *ptr_result = result.ptr<float>(i);float *ptr_temp = temp.ptr<float>(i);float *ptr_img1 = img2.ptr<float>(i);for (int j = 0; j < temp.cols; j++) {ptr_result[j * 3 + 0] = (1 - alpha)*ptr_img1[j * 3 + 0] + alpha*ptr_temp[j * 3 + 0];ptr_result[j * 3 + 1] = (1 - alpha)*ptr_img1[j * 3 + 1] + alpha*ptr_temp[j * 3 + 1];ptr_result[j * 3 + 2] = (1 - alpha)*ptr_img1[j * 3 + 2] + alpha*ptr_temp[j * 3 + 2];}}result.convertTo(result, CV_8U);imshow("result", result);return result;}
0 0
- 基于FPGA的Alpha半透明图像叠加算法实现
- Alpha 混合:两个半透明色的叠加
- 像素叠加实现图片的半透明混合
- 图像半透明的实现
- 基于FPGA的RGB565_YCbCr_Gray算法实现
- 基于FPGA的彩色图像Bayer变换实现
- FPGA基于CORDIC算法的求平方实现
- 基于FPGA的CORDIC算法实现——Verilog版
- 利用OpenCV实现图像的叠加
- [转]利用OpenCV实现图像的叠加
- 基于FPGA的图像预处理系统(图)
- 基于FPGA的LCD12864图像显示
- 基于FPGA的图像去噪
- 基于FPGA的多目标图像跟踪技术
- 基于FPGA的彩色图像显示
- 基于FPGA的图像比例缩放
- 基于直方图的图像二值化算法实现
- Alpha叠加
- 【codeforces】Uncowed Forces
- MongoDB从不懂到装懂其四(数据备份、恢复、导入、导出)
- <<More Effective C++>>读书笔记2: 运算符
- day2 HDU 2141 Can you find it?
- [李景山php]每天laravel-20160921|Redis Database.php
- 基于FPGA的Alpha半透明图像叠加算法实现
- 为什么析构函数常声明为虚函数?
- python 模拟登录csdn并获取博客列表等操作
- 快学scala 第十一章 操作符 读书笔记及习题答案代码
- 深入理解 Android 中的 Matrix
- Android 6.0 通话UI设计模式分析(MVC\MVP\MVVM)
- Post Views Options怎么设置,WP-PostViews的后台设置五步法详解
- java反向工程神器ermaster
- 几款极好的 JavaScript 文件上传插件