编辑: 怪只怪这光太美 | 2019-07-17 |
float* myarr = new float[rows*cols];
// step 1) initializing CvMat header CvMat mat = cvMat( rows, cols, CV_32FC1, // 32-bit floating-point, single channel type myarr // user data pointer (no data is copied) );
// step 2) using cv functions, e.g. calculating l2 (Frobenius) norm double norm = cvNorm( &
mat, 0, CV_L2 );
... delete myarr;
其它情况在参考手册中有描述.见cvCreateMatHeader, cvInitMatHeader, cvCreateImageHeader, cvSetData etc. 如何加载和显示图像 /* usage: prog */ #include cv.h #include highgui.h int main( int argc, char** argv ) { IplImage* img;
if( argc ==
2 &
&
(img = cvLoadImage( argv[1], 1)) !=
0 ) { cvNamedWindow( Image view ,
1 );
cvShowImage( Image view , img );
cvWaitKey(0);
// very important, contains event processing loop inside cvDestroyWindow( Image view );
cvReleaseImage( &
img );
return 0;
} return -1;
} 如何发现和处理轮廓线 请看演示 squares ? ........