使用指针遍历图像
2014-04-14 14:43
190 查看
#include<opencv2\core\core.hpp> #include<opencv2\imgproc\imgproc.hpp> #include<opencv2\highgui\highgui.hpp> #include<iostream> using namespace std; using namespace cv; //颜色缩减函数 void colorReduce(cv::Mat &image,int div=64) { int nl=image.rows; int nc=image.cols*image.channels(); for(int j=0;j<nl;j++) { uchar* data=image.ptr<uchar>(j); for(int i=0;i<nc;i++) { data[i]=data[i]/div*div+div/2; } } } int main() { cv::Mat image=cv::imread("d:\\test\\opencv\\img.jpg"); colorReduce(image); cv::namedWindow("output"); cv::imshow("output",image); waitKey(0); return 0; }
相关文章推荐
- 使用指针遍历图像
- 使用指针的方式遍历图像数据
- [OpenCV2]使用指针遍历图像
- OPenCV2 如何使用指针的方式遍历图像
- OPENCV学习笔记2-2_图像遍历(使用指针)
- 学习《OpenCV 2 计算机视觉编程手册》第二章---使用指针遍历图像案例
- opencv学习笔记(2)----颜色缩减(使用指针遍历图像)
- OpenCV学习篇之五 使用指针遍历图像
- OpenCV学习之二: 使用指针遍历图像
- OpenCV学习之三:使用迭代器遍历图像
- 072.Traverse Array 使用指针遍历数组
- OpenCV 2 学习笔记(6): 使用指针来扫描图像:减少图像的位深
- 使用迭代器遍历图像
- opencv249图片指定颜色抠图(指针遍历图像法)
- PHP学习笔记——使用数组的内部指针控制函数遍历数组
- 指针遍历图像方法总结
- [OpenCV2]使用迭代器遍历指针
- VTK中迭代器的使用,并将指针中的图像保存
- java中使用for遍历集合是注意的空指针异常
- 使用指针遍历二维数组