转自http://blog.csdn.net/qq_18343569/article/details/47953441

getRectSubPix函数

2015-08-24 16:47 1104人阅读 评论(0) 收藏 举报
 分类:
opencv函数库 之图像几何变换(8) 

getRectSubPix函数

函数作用:

从原图像中提取提取一个感兴趣的矩形区域图像

函数调用形式:

C++: void getRectSubPix(InputArray image, Size patchSize, Point2f center, OutputArray patch, int patchType=-1 )

 

参数理解:

InputArray image:输入图像

Size patchSize:获取矩形的大小

Point2f center:获取的矩形在原图像中的位置

OutputArray patch:表示输出的图像

int patchType=-1 :表示输出图像的深度

OpenCV代码:

  1. <span style="font-family:sans-serif;"><span style="font-size:18px;">#include <opencv2/core/core.hpp>
  2. #include <opencv2/highgui/highgui.hpp>
  3. #include <opencv2/imgproc/imgproc.hpp>
  4. #include <iostream>
  5. #include<cv.h>
  6. #include<stdlib.h>
  7. using namespace cv;
  8. using namespace std;
  9. int main()
  10. {
  11. Mat src, dst;
  12. src = imread("D:6.jpg");
  13. /*Mat kx = (Mat_<float>(1, 3) << 0,-1,0);
  14. Mat ky = (Mat_<float>(1, 3) << -1,0, -1);
  15. sepFilter2D(src, dst, src.depth(),kx,ky,Point(-1,-1),0,BORDER_DEFAULT );*/
  16. getRectSubPix(src, Size(src.cols / 5, src.rows / 5), Point2f(src.cols / 2, src.rows / 2), dst, -1);
  17. imshow("shiyan", dst);
  18. waitKey(0);
  19. return 0;
  20. }</span></span>  getRectSubPix函数

最新文章

  1. Python进阶【第二篇】多线程、消息队列queue
  2. BZOJ1856[SCOI2010]字符串
  3. C#属性-索引器-里氏替换-多态-虚方法-抽象-接口-泛型-
  4. NodeOS操作系统
  5. Python UnicodeEncodeError: &#39;ascii&#39; codec can&#39;t encode characters in position 0-4: ordinal not in range(128)
  6. android Camera 结构
  7. git 冲突解决(转载)
  8. MVC中Jqgrid的用法
  9. Microsoft TFS 如何显示在Windows 的上下文菜单中
  10. selenium在chrome上运行报 Element is not clickable at point (1096, 26)
  11. Html学习笔记4
  12. 24种设计模式--工厂方法模式【Factory Method Pattern】
  13. 项目中引用ThinkPHP框架
  14. iText操作word文档总结
  15. 根据Mob官网的天气预报接口写了一个简单的demo
  16. 二维码生成api
  17. 持久化 XSS:ServiceWorkers 利用
  18. 彻底删除mysql服务(清理注册表)
  19. Spring MVC ,使用mvc:resources标签后,处理器无法被访问
  20. jenkins构建完成后,执行的命令行的东西也会自动结束的解决办法

热门文章

  1. 【.Net】调用Web API的几种方式
  2. 配合Jenkins自动化构建,bat脚本(二)
  3. Solr单机版安装
  4. hbase-0.20.6/bin/hbase-daemon.sh: Permission denied
  5. C#中的索引器的简单理解和用法
  6. grunt-2x2x
  7. HihoCoder 1190连通性&#183;四
  8. hadoop-hbase学习笔记
  9. C++对C语言的拓展(3)—— 默认参数和占位参数
  10. 高性能服务器架构 的几个注意点 (High-Performance Server Architecture)