文章目录

  • Mat
  • 读取图片---imread
  • 创建窗体---nameWindow
  • 图片显示---imshow
  • 窗口销毁---destroyAllWindwos
  • 色彩转换---cvtColor

入门类

Mat

创建空白图像

static MatExpr ones(Size size, int type);
static MatExpr zeros(Size size, int type);
static MatExpr ones(int rows, int cols, int type);
...

可以通过Mat获取图片的行列通道(row,col,channels);
需要注意的是,不使用clone与copy方法进行mat对象的赋值并不会为新对象开辟内存空间

 Mat src = imread(R"(E:\CopyDesktop\working\OpenCV4_test\source\image\wei.jpg)");Mat img1,img2;img1 = src.clone();src.copyTo(img2);

读取图片—imread

 Mat imread( const String& filename, int flags = IMREAD_COLOR );
enum ImreadModes {IMREAD_UNCHANGED            = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).IMREAD_GRAYSCALE            = 0,  //!< If set, always convert image to the single channel grayscale image (codec internal conversion).IMREAD_COLOR                = 1,  //!< If set, always convert image to the 3 channel BGR color image.IMREAD_ANYDEPTH             = 2,  //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.IMREAD_ANYCOLOR             = 4,  //!< If set, the image is read in any possible color format.IMREAD_LOAD_GDAL            = 8,  //!< If set, use the gdal driver for loading the image.IMREAD_REDUCED_GRAYSCALE_2  = 16, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/2.IMREAD_REDUCED_COLOR_2      = 17, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.IMREAD_REDUCED_GRAYSCALE_4  = 32, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/4.IMREAD_REDUCED_COLOR_4      = 33, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.IMREAD_REDUCED_GRAYSCALE_8  = 64, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/8.IMREAD_REDUCED_COLOR_8      = 65, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.IMREAD_IGNORE_ORIENTATION   = 128 //!< If set, do not rotate the image according to EXIF's orientation flag.};

创建窗体—nameWindow

 void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
enum WindowFlags {WINDOW_NORMAL     = 0x00000000, //!< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size.WINDOW_AUTOSIZE   = 0x00000001, //!< the user cannot resize the window, the size is constrainted by the image displayed.WINDOW_OPENGL     = 0x00001000, //!< window with opengl support.WINDOW_FULLSCREEN = 1,          //!< change the window to fullscreen.WINDOW_FREERATIO  = 0x00000100, //!< the image expends as much as it can (no ratio constraint).WINDOW_KEEPRATIO  = 0x00000000, //!< the ratio of the image is respected.WINDOW_GUI_EXPANDED=0x00000000, //!< status bar and tool barWINDOW_GUI_NORMAL = 0x00000010, //!< old fashious way};

图片显示—imshow

 void imshow(const String& winname, InputArray mat);

窗口销毁—destroyAllWindwos

destroyAllWindows();

色彩转换—cvtColor

void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 );

OpenCV4--->基础函数,与操作相关推荐

  1. python 基础语法--print,input,open的内置函数的操作

    print语法 基础语法 print(12) print('你好,中国') print("你好,人民") print("""万岁"" ...

  2. 计算机基础表格函数基础知识大全,大一计算机题库和答案:大一计算机基础excel表格操作题求解if函数部分...

    大一计算机基础excel表格操作题求解if函数部分 引号呢?字符串必须要用引号引起来,不然就是变量,就非法了.要类似这样: =IF(C3="电子",11000) 大学计算机基础期末 ...

  3. OpenCV4一部分函数目录

    OpenCV4函数+基本功能说明 引言 一.基础函数使用 Imread函数--读取图片 namedWindow函数--创建自定名窗口 imshow函数--将自定名的窗口展示 destroyWindow ...

  4. python文件替换一行_python基础_文件操作实现全文或单行替换的方法

    这篇文章主要介绍了关于python基础_文件操作实现全文或单行替换的方法,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 python修改文件时,使用w模式会将原本的文件清空/覆盖.可以 ...

  5. Jquery基础之DOM操作

    Jquery基础之DOM操作 Dom是Document Object Model的缩写,意思是文档对象模型.DOM是一种与浏览器.平台.语言无关的接口,使用该接口可以轻松访问页面中所有的标准组件.DO ...

  6. 深度学习(三)theano学习笔记(2)基础函数-未完待续

    theano学习笔记(2)基础函数 1.随机函数库的调用 2.卷积神经网络 [python] view plaincopy #-*-coding:utf-8-*- import theano impo ...

  7. pytorch基础函数学习

    深度学习框架,似乎永远离不开哪个最热哪个最实用的话题,自己接触甚浅,尚不敢对齐进行大加评论,这里也只是初步接触.目前常见的有TensorFlow,pytorch,Keras等,至于目前哪个做好用,就像 ...

  8. ostream作为函数返回值_GO语言基础函数

    GO语言基础–函数 函数是组织好的.可重复使用的.用于执行指定任务的代码块.本文介绍了Go语言中函数的相关内容. 函数定义 Go语言中定义函数使用func关键字,具体格式如下: func 函数名(参数 ...

  9. 【opencv系列08】OpenCV4.X图像融合操作

    点击上方"AI搞事情"关注我们 图像叠加 add(src1, src2, dst=None, mask=None, dtype=None)函数或者numpy操作实现图像按位相加,若 ...

  10. [Python从零到壹] 八.数据库之MySQL和Sqlite基础知识及操作万字详解

    欢迎大家来到"Python从零到壹",在这里我将分享约200篇Python系列文章,带大家一起去学习和玩耍,看看Python这个有趣的世界.所有文章都将结合案例.代码和作者的经验讲 ...

最新文章

  1. MAMP升级mysql5.6到5.7
  2. [XSY] 宝藏(LCS,DP)
  3. [剑指offer][JAVA][面试题第13题][机器人的运动][DFS][BFS]
  4. spark:SparkUI界面
  5. 【Codeforces 486C】Palindrome Transformation
  6. AIX下使用xmanager
  7. 【IoT】 产品研发:位深为1的BMP格式图片详解
  8. 数据库学习总结与心得
  9. Android开发之音乐播放器
  10. Mac上配置svn diff为kdiff3
  11. 基于深度学习的单目视觉深度估计研究综述
  12. Reasoning-RCNN 论文笔记
  13. php接入钉钉注册回调
  14. Java快车读书笔记
  15. JVM学习 -- JVM 性能调优监控工具 jps、jstack、jmap、jhat、jstat、hprof 使用详解
  16. 网站人物角色的创建相关整理
  17. 继续教育计算机专业能学到东西吗,继续教育个人学习心得体会
  18. 微信电脑端双击不能放大图片怎么回事_电脑微信收到的截图是这样子的,双击一下打开才看的到,我自己也发不出截图...
  19. 【亲测有效】mac电脑也能玩魔兽世界怀旧版(wow经典怀旧版)
  20. Scala(三) 类和特质

热门文章

  1. 计算机硬盘应该什么格式化,磁盘格式化是什么意思?快速格式化和一般格式化有什么区别...
  2. 微信社群运营是什么,如何做好社群运营?
  3. Arduino应用开发——TCP/IP无线传输
  4. iOS系统与Windows电脑如何做到无线传输文件?
  5. django 分拆views 提示 module ‘app001.views‘ has no attribute ‘xxx‘
  6. android自定义视频列表,Android列表视频播放开发之路
  7. 研大考研:2015考研政治认识论知识点
  8. 利用AFD进行播出级的自动幅型比控制
  9. 计算机病毒如何彻底去除,电脑中病毒最彻底的清除方法 彻底清理删除电脑病毒的几种简单方法...
  10. 物流app开发需要多少钱