cvThreshold ,cvGet2D,cvsmooth,cvSaveImage

来源:互联网 发布:网络黄金egd能上市吗 编辑:程序博客网 时间:2024/06/03 10:18

OpenCV中获取图像指定位置处的像素值

CvScalar s;

s=cvGet2D(src,i,j);

printf("%d",s.val[0]);

printf("%d",s.val[1]);

printf("%d",s.val[2]);

或者,直接对指针进行操作

uchar* p=src->imageData;

p[i*src->widthStep+j];

联合在一起就是

((uchar*)(src->imageData))[i*src->widthStep+j];

注意双括号及其位置。

cvsub 图像相减。。


CvMemStorage

OpenCV 用 CvMemStorage来应付动态对象的内存分配( handle memory allocation for dynamic objects)

 

用 cvCreateMemStorage()  来创建一个 CvMemStorage, 如果参数为0,那么默认的块大小为 64 KB ( If this argument is set to 0 then the default block size (64kB) will be used)

 

用 cvReleaseMemStorage() 可以撤消多个对象所占用的内存,例如多个图像、矩阵等

 

用 cvClearMemStorage() 则可撤消单个对象所占用的内存。



cvSaveImage( "135-gray-smooth-T145.jpg", dstt);

原创粉丝点击