2011年9月29日
摘要: View Code 1 int _tmain(int argc,_TCHAR* argv[]) 2 { 3 //用固定数据创建一个矩阵 4 float vals[]={0.664,-0.500,0.500,0.866}; 5 CvMat rotmat; 6 cvInitMatHeader(&rotmat,2,2,CV_32FC1,vals); 7 int number = cvGetDims(&rotmat,0); 8 CvMat* mat = cvCreateMat(5,5,CV_32FC1); 9 //用简单方法对矩阵数据存取。10... 阅读全文
posted @ 2011-09-29 19:33 Ming明、 阅读(4558) 评论(0) 推荐(1) 编辑
摘要: View Code 1 int _tmain(int argc, _TCHAR* argv[]) 2 { 3 CvCapture* capture=0; 4 //读入视频文件 5 capture = cvCreateFileCapture("tree.avi"); 6 if(!capture) 7 return -1; 8 //将下一帧视频文件载入内存 9 IplImage *bgr_frame = cvQueryFrame(capture);10 11 //获取capture的各种属性12 //打开一个... 阅读全文
posted @ 2011-09-29 19:17 Ming明、 阅读(592) 评论(0) 推荐(0) 编辑
摘要: View Code 1 //累加一个三通道矩阵中的所有元素 2 float sum(const CvMat* mat) 3 { 4 float s=0.0f; 5 for(int row=0;row<mat->rows;row++) 6 { 7 const float* prt=(const float*)(mat->data->ptr+row*mat->step); 8 for (int col=0;col<mat->cols;col++) 9 {10 s+=*prt++;11 ... 阅读全文
posted @ 2011-09-29 16:29 Ming明、 阅读(1107) 评论(0) 推荐(0) 编辑
摘要: View Code 1 // opencvdemo.cpp : Defines the entry point for the console application. 2 // 3 #include "stdafx.h" 4 5 #ifdef _CH_ 6 #pragma package <opencv> 7 #endif 8 9 #ifndef _EiC10 #include "cv.h"11 #include "highgui.h"12 #endif13 14 IplImage * in;15 16 //缩放函数17 阅读全文
posted @ 2011-09-29 10:30 Ming明、 阅读(874) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include "stdafx.h" 2 #include "cv.h" 3 #include "cxcore.h" 4 #include "highgui.h" 5 #ifdef _CH_ 6 #pragma package <opencv> 7 #endif 8 #ifndef _EiC 9 #include "cv.h"10 #include "highgui.h"11 #endif12 char wndname[] = " 阅读全文
posted @ 2011-09-29 10:01 Ming明、 阅读(1776) 评论(0) 推荐(0) 编辑