学海网 文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > opencv2遍历图像(源程序)

opencv2遍历图像(源程序)

opencv2遍历图像(源程序)

#include <opencv2/core/core.hpp>

#include <opencv2/highgui/highgui.hpp>

#include <opencv2/imgproc/imgproc.hpp>

#include <iostream>

#include <vector>

using namespace cv;

using namespace std;

Point sum_point(Point points[],int k,int step);

void main()

{

Mat image;

image=imread("1.jpg");

cout<<"行数:"<<image.rows<<endl;

cout<<"列数:"<<image.cols<<endl;

imshow("original picture",image);

Point points[10000];

int k=0;

for(int i=0;i<image.rows;i++)

for (int j=0;j<image.cols;j++)

{

if((image.at<Vec3b>(i,j)[2]-(image.at<Vec3b>(i,j)[0]+image.at<Vec3b>(i,j)[1])/2)>50) {image.at<Vec3b>(i,j)[0]=255;

image.at<Vec3b>(i,j)[1]=0;

image.at<Vec3b>(i,j)[2]=0;

points[k]=Point(i,j);

k++;

}

else{

image.at<Vec3b>(i,j)[0]=255;

image.at<Vec3b>(i,j)[1]=255;

image.at<Vec3b>(i,j)[2]=255;

}

}

// 用r通道分量

int points_num=k;

cout<<"key points count="<<points_num<<endl;

int step=image.rows/6;

Point points_centern[6];

double x,y,count;

k=0;

for(k=0;k<4;k++)

{

count=0,x=0,y=0;

for(int i=0;i<points_num;i++)

{

if((k*step)<points[i].x &&points[i].x<step*(k+1))

{

第1页

TOP相关主题

  • opencv2 遍历图像
  • opencv遍历图像
  • opencv遍历图像像素
  • opencv2 图像旋转
  • opencv2 二值图像取反
  • opencv2保存图像
  • opencv2 求图像方差
  • opencv2 图像拼接

我要评论

相关文档

  • OpenCV2学习笔记

    #include<opencv2\imgproc\imgproc.hpp> 而#include "cv.h"这是旧的代码...Result: 三:通过迭代器遍历图像 C++中迭代器不熟的可以看看我转载的一篇 blog:...

  • OpenCV如何扫描图像、利用查找表和计时

    ? ? ? 如何遍历图像中的每一个像素? OpenCV 的...在该程序中,我们首先要计算查找表。 int divideWith...2.迭代法 The iterator (safe) method 在高性能法...

  • opencv编写笔记_图文

    加载图像并显示的程序: 没有把 include 文件夹里的 opencv 与 opencv2 文件夹...一个有效的办法就是遍历图像的所有像素,修改其值,Iplimage结构的图 像数据区...

  • VC图像二值化三个源程序

    VC图像二值化三个源程序_计算机软件及应用_IT/计算机_专业资料。/***...//迭代求最佳阈值 NewThreshold = (MinGrayValue + MaxGrayValue)/2; Threshold ...

  • OpenCV基本操作_图文

    OpenCV2.4.10的最基础操作,有示例代码OpenCV 基本...比如32位深度图像载入便是相应的深度 =1, =2, =...实例: 3、图像的数据访问(遍历) 1、指针访问 通过...

  • matlab图像处理各种程序代码

    matlab图像处理各种程序代码_计算机软件及应用_IT/计算机_专业资料。matlab的各种...4》滤波器频率响应 (请自己运行查看) 2. 图像增强 图像增强是指按特定的需要...

  • 图像处理方法及源程序

    图像处理方法及源程序_工学_高等教育_教育专区。图像处理方法国际图像艺术推广机构...图像实验目录图像增强: 1.对比度增强(dip1.m) 2. 对数变换(dip2.m) 3....

  • 图像处理算法源程序

    使用图像采集卡分三步,首先安装采集卡的驱 动程序,并将虚拟驱动文件 VxD.vxd ...(msg.message==WM_LBUTTONDBLCLK) bGrabMark = FALSE; W32_ReadXMS2Buf (w...

  • 图像处理matlab源程序

    1.图像反转 MATLAB 程序实现如下: I=imread('xian.bmp'); J=double(I); J=-J+(256-1); H=uint8(J); subplot(1,2,1),imshow(I); subplot(1,2...

  • fcm方法进行图像分割源程序

    fcm方法进行图像分割源程序_计算机软件及应用_IT/计算机_专业资料。1.myfcm 函数...%灰度图像 eval(['I=imread(''',file, ''');']); end; I = im2...

站点地图 | 文档上传 | 侵权投诉 | 手机版
新浪认证  诚信网站  绿色网站  可信网站   非经营性网站备案
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.xuehai.net All Rights Reserved.  email
返回顶部