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

学习OpenCV课后题3.4

2010-07-13 16:51 246 查看
// Ex3_4.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <cv.h>
#include <cvcam.h>
#include <cxcore.h>
#include <highgui.h>

#pragma comment(lib,"cv.lib")
#pragma comment(lib,"cvcam.lib")
#pragma comment(lib,"cxcore.lib")
#pragma comment(lib,"highgui.lib")

int main(int argc, char* argv[])
{
CvMat *Mat = cvCreateMat( atoi(argv[1]), atoi(argv[2]), CV_8UC3);
cvSetZero(Mat);

for (int nHeight = 100; nHeight < 300; nHeight++ )
{
uchar *ptr = (uchar*)(Mat->data.ptr + nHeight*Mat->step);
for (int nWidth = 100; nWidth < 300; nWidth++)
{
ptr[nWidth*3+1] = 255;
}
}

cvNamedWindow("Show");
cvShowImage("Show",Mat);

cvWaitKey();

cvReleaseMat(&Mat);
cvDestroyWindow("Show");

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