19,468
社区成员
发帖
与我相关
我的任务
分享
[code=c]#include "cv.h"
#include "highgui.h"
#include "cvcam.h"
#include "cxcore.h"
#include "stdlib.h"
#include "tchar.h"
int main(int argc,char **argv)
{
IplImage*src=NULL;
src=cvLoadImage("wiener.bmp",0);
for(int i=0;i<src->height;i++)
{
for(int j=0;j<src->width;j++)
{
if(((uchar *)(src->imageData + i*src->widthStep))[j]==30)
{
((uchar *)(src->imageData + i*src->widthStep))[j]=0;
}
else
((uchar *)(src->imageData + i*src->widthStep))[j]=255;
}
}
cvSaveImage("gray_30.bmp",src);
return 0;
}
[/code]