在ROS下编程的时候,发现一个例子是调用opencv2/core/wimage.hpp类的,去年的时候,我倒仔细查看这个头文件,没有深研究,百度,谷歌了一番,都没有找到任何资料。现在趁这个机会,好好研究下他。
其实,我本人是很喜欢C++,也远胜于爱C的。这个类库是Google开发的,另外,同事共享了一个Google开发C++的编程规范(http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml),我在这里也贴出来,好的编程习惯,对己对他人都有莫大的好处的。
这个头文件的分析,我是写到这里(http://blog.sina.com.cn/s/blog_661159d50100r1g7.html)
里面定义了三个模板类:WImage,WImageBuffer,WImageView (一个是虚基类,另外两个,一个是作为buffer配置和组织,一个是便于组织外数据和子图的基类);另外还有三个WImage, WImageBufferC, WImageViewC.
这里写几个简单的测试例子,便于理解(测试环境opencv2.2+vs2008),这个类特别适合对于图像操作与理解,可以把图像想象为数组,所以操作起来就跟matlab一样。
Example 1, Show image and Show ROI
And the results of this code:
Abviously, it is help for sub_image-or-ROI's operating.
Example 2: operate on external data
And this result is :
Also this is useful for external data, and this is also useful for operating on image