学习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;
}
//
#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;
}
相关文章推荐
- 读取摄像头并存盘(学习openCV课后题2.3改进)
- 学习OpenCV课后题3.6
- 学习OpenCV课后题4.5(有点糙)
- 基于QT5的opencv学习之《学习opencv课后练习3-7》
- 学习OpenCV(5) opencv3.4 with CUDA编译
- 学习OpenCV课后题3.7
- 学习OpenCV课后题4.7
- 在Lubuntu上搭建python3.4和OpenCV开发环境并且运行DNQ-Atari深度学习项目
- 学习OpenCV第三章课后题(打卡)
- 学习opencv第二章课后题4,5
- 读取摄像头数据(学习openCV课后题 2.4)
- 根据滚动条位置缩放图像(学习OpenCV课后题 2.5)
- 学习OpenCV 第四章课后题第一题(合并图像、缩放、字体)
- 学习opencv 课后8.5
- 学习OpenCV课后题4.2
- 学习Opencv第3章课后习题
- 学习opencv 课后8.5
- 学习OpenCV课后题3.8(b)
- 学习OpenCV课后题3.2
- 学习Opencv第2章课后习题