标签:opencv 内存
刚需要用到接受到的jpg二进制文件,直接在内存做解析,mark一下,下面给出测试代码。
FILE *file; file = fopen("D:/221606322483223.jpg", "rb"); fseek(file, 0, SEEK_END); fpos_t pos; fgetpos(file, &pos); char *data = new char[pos]; fseek(file, 0, 0); int sjinum=fread(data, sizeof(char), pos, file); fclose(file); CvMat mat = cvMat(239, 251, CV_8UC3, data); IplImage *pIplImage = cvDecodeImage(&mat, 1); cvSaveImage("D:/2.jpg", pIplImage); delete[]data; Mat mtx(pIplImage); Mat nmat=mtx.clone(); cvReleaseImage(&pIplImage);
本文出自 “叶子” 博客,请务必保留此出处http://luoqiu.blog.51cto.com/2198651/1638106
标签:opencv 内存
原文地址:http://luoqiu.blog.51cto.com/2198651/1638106