当前位置: 首页 > news >正文

做专业维修网站网络广告策划书范文

做专业维修网站,网络广告策划书范文,长沙这边网站建设,郑州网站建设没效果图像的缩放 resize(image, image, Size(round(image.cols * 0.5), round(image.rows * 0.5))); 输入图像 输出图像 大小变换 canny边缘算子的使用 cvtColor(image, gray, COLOR_BGR2GRAY);Canny(gray, canny_mat, 40, 100); 必须先转化为灰度图,作为输入 超过100是真…

图像的缩放

	resize(image, image, Size(round(image.cols * 0.5), round(image.rows * 0.5)));

 输入图像 输出图像 大小变换

canny边缘算子的使用

	cvtColor(image, gray, COLOR_BGR2GRAY);Canny(gray, canny_mat, 40, 100);

 必须先转化为灰度图,作为输入 超过100是真的边缘 低于40是确定不是边缘 在中间若连接边缘 则为边缘 

普通旋转缩放变换(仿射变换)

 获取仿射变换矩阵

	float angel = -10.0, scale = 1;Mat dstmat;Point2f center(image.cols * 0.5, image.rows * 0.5);Mat affine_matrix = getRotationMatrix2D(center, angel, scale);

获取仿射变换的矩阵 中心点 旋转角度 大小是否变换

-10是顺时针转

仿射变换函数

warpAffine(image, dstmat, affine_matrix,image.size());

输入图 输出图 仿射变换矩阵 画布的大小 

这样的仿射变换有旋转的缺陷,因为大小和原图一样,但旋转后,外接矩形肯定大于原图,所以溢出的部分会看不到,后期会更新改进版

点到点的仿射变换(6变量 所以要3个点对3个点)

	Mat affine_Mat;const cv::Point2f src_pt[] = {cv::Point2f(100,100),cv::Point2f(20,30),cv::Point2f(70,90),};const cv::Point2f warp_pt[] = {cv::Point2f(50,100),cv::Point2f(50,20),cv::Point2f(70,96),};Mat affine_matrix2 = cv::getAffineTransform(src_pt, warp_pt);warpAffine(image, affine_Mat, affine_matrix2,image.size());

一个点对应一个点 

计算机会帮我们求出仿射变换的矩阵

点到点的透射变换(8变量 所以要4个点对4个点)

	Mat perspective_Mat;cv::Point2f pts1[] = {cv::Point2f(150,150),cv::Point2f(150,300),cv::Point2f(350,300),cv::Point2f(350,150),};cv::Point2f pts2[] = {cv::Point2f(200,150),cv::Point2f(200,300),cv::Point2f(340,270),cv::Point2f(340,180),};Mat perspective_matrix = cv::getPerspectiveTransform(pts1, pts2);warpPerspective(image, perspective_Mat, perspective_matrix, image.size());

 总体代码:

#include <opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;int main() {Mat image = imread("lena.jpeg");imshow("lena", image);waitKey(0);cvDestroyAllWindows();resize(image, image, Size(round(image.cols * 0.5), round(image.rows * 0.5)));imshow("lena", image);waitKey(0);cvDestroyAllWindows();Mat gray;Mat canny_mat;cvtColor(image, gray, COLOR_BGR2GRAY);Canny(gray, canny_mat, 40, 100);imshow("canny_mat", canny_mat);waitKey(0);cvDestroyAllWindows();	float angel = -10.0, scale = 1;Mat dstmat;Point2f center(image.cols * 0.5, image.rows * 0.5);Mat affine_matrix = getRotationMatrix2D(center, angel, scale);warpAffine(image, dstmat, affine_matrix,image.size());imshow("dstmat", dstmat);waitKey(0);cvDestroyAllWindows();Mat affine_Mat;const cv::Point2f src_pt[] = {cv::Point2f(100,100),cv::Point2f(20,30),cv::Point2f(70,90),};const cv::Point2f warp_pt[] = {cv::Point2f(50,100),cv::Point2f(50,20),cv::Point2f(70,96),};Mat affine_matrix2 = cv::getAffineTransform(src_pt, warp_pt);warpAffine(image, affine_Mat, affine_matrix2,image.size());imshow("affine_Mat", affine_Mat);waitKey(0);cvDestroyAllWindows();Mat perspective_Mat;cv::Point2f pts1[] = {cv::Point2f(150,150),cv::Point2f(150,300),cv::Point2f(350,300),cv::Point2f(350,150),};cv::Point2f pts2[] = {cv::Point2f(200,150),cv::Point2f(200,300),cv::Point2f(340,270),cv::Point2f(340,180),};Mat perspective_matrix = cv::getPerspectiveTransform(pts1, pts2);warpPerspective(image, perspective_Mat, perspective_matrix, image.size());imshow("perspective_Mat", perspective_Mat);waitKey(0);cvDestroyAllWindows();//疑问 图像的平移如何实现  image.size()是什么个东西 如何改变图像大小?return 0;
}

http://www.hkea.cn/news/546199/

相关文章:

  • 如何自己做个简单网站seo知识点
  • 有哪些做批发的网站有哪些手续百度推广优化是什么意思
  • 用阿里巴巴店铺做公司网站怎么样引擎搜索有哪些
  • 网页制作软件属于什么软件类别简述seo的优化流程
  • 网站建设 公司新闻谷歌排名网站优化
  • 怎样做自己的vip解析网站佛山外贸seo
  • 我的网站在百度搜不到了seo是什么职业做什么的
  • 网站私信界面国外网站seo免费
  • wordpress mysql类惠州网站seo
  • 为什么做网站必须要用域名举出最新的网络营销的案例
  • 电子请柬网站开发百度竞价推广登录入口
  • 网站设计与推广国际时事新闻2022最新
  • 柬埔寨网站开发营销技巧和营销方法
  • 网站建立价格长沙网站外包公司
  • 王建设医生个人网站免费google账号注册入口
  • 免费自建手机网站搜索引擎优化的方法包括
  • 甘肃省建设工程安全质量监督管理局网站官网拉新项目官方一手平台
  • 做电影网站赚钱武汉新闻最新消息
  • 做网站没有成本的方法上海百度分公司电话
  • 寺庙网站建设百度ai人工智能
  • 完成公司网站建设下载关键词推广软件
  • wordpress如何关闭网站下载app
  • WordPress小程序二次修改石家庄seo排名外包
  • 做百度关键词网站厦门seo外包
  • 泉州seo-泉州网站建设公司谷歌关键词搜索工具
  • 组织部网站建设方案行业关键词分类
  • 上海黄浦 网站制作中国搜索引擎排名2021
  • 手机网站建设 cms营销技巧和营销方法
  • 平顶山做网站优化微博搜索引擎优化
  • 网站如何做品牌宣传海报每日舆情信息报送