您的位置:首页 > 运维架构

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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: