摘要: 一)cvCreateMat创建和分配数据CvCreateMat会创建CvMat,并为CvMat分配数据。cvCreateMat可以配合cvInitMatHeader来初始化CvMat对象。因为CvCreateMat创建的CvMat,对象在堆上,数据也在堆上,所以cvInitMatHeader在指定新的数据所在的位置的同时,也将CvMat::hdr_refcount和CvMat::refcount都置为0,以便cvReleaseMat释放CvMat对象和数据。#include #include int main(){ double a[9]={1,2,3,4,5,6,7,8,9}; double 阅读全文
posted @ 2013-11-02 22:59 xingrun 阅读(8318) 评论(0) 推荐(0) 编辑
摘要: CV_IMPL CvMat* cvEncodeImage( const char* ext,const CvArr* arr, const int* _params )CV_IMPL IplImage* cvDecodeImage( const CvMat* _buf, int iscolor )据说可以编码bmp, png, ppm and tiff (encoding only).解码测试例子:f=fopen("a.jpg","r");unsigned char *m=(unsigned char*)malloc(1267*791);fread(m, 阅读全文
posted @ 2013-11-02 22:55 xingrun 阅读(4410) 评论(0) 推荐(0) 编辑