opencv载入图片,并得到行列值
2014-04-04 15:32
225 查看
之前看了opencv载入图像,在这里总结一下。
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
int main(int argc, char *argv[])
{
IplImage* img = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
// 载入图像
img=cvLoadImage("E:\\生物识别\\原图像\\IMG_0008.jpg");
if(!img)
{
printf("Could not load image file: %s/n",argv[1]);
exit(0);
}
// 获取图像信息
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
// 创建窗口
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 100, 100);
// 显示图像
cvShowImage("mainWin", img );
cvWaitKey(0);
cvReleaseImage(&img );
return 0;
}
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
int main(int argc, char *argv[])
{
IplImage* img = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
// 载入图像
img=cvLoadImage("E:\\生物识别\\原图像\\IMG_0008.jpg");
if(!img)
{
printf("Could not load image file: %s/n",argv[1]);
exit(0);
}
// 获取图像信息
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
// 创建窗口
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 100, 100);
// 显示图像
cvShowImage("mainWin", img );
cvWaitKey(0);
cvReleaseImage(&img );
return 0;
}
相关文章推荐
- top命令
- 监控设施JConsole学习
- linux 设置send、recv超时
- shell 语法示例
- Linux驱动程序学习备忘之六
- linux下乱码问题总结
- Linux常用命令解析
- Tomcat结构以及处理一个请求的过程
- SEO基础知识——镜像网站
- 大津法及最优迭代求分割阈值(opencv2)
- linux启动tomcat异常:The BASEDIR environment variable is not defined correctly
- Linux进程间通信(四)---信号通信之信号发送捕捉kill()、raise()、alarm()、pause()及其基础实验
- Linux进程间通信(三)---管道通信之有名管道及其基础实验
- Linux 使用uinput创建虚拟input设备
- 关于org.apache.jasper.JasperException: Unable to compile class for JSP问题的解决
- centos svn快速搭建
- Linux进程间通信(二)---管道通信之无名管道及其基础实验
- linux 编译 openssl DES_SPtrans
- Linux进程间通信(一)---进程间通信概述及其种类
- 在Windows下搭建开发Linux程序的环境