标签:color width 2014 for window amp
#include<Windows.h>
#include<cv.h>
#include<highgui.h>
#include <cxcore.h>
int main(){
IplImage* img = cvLoadImage("1.jpg");
IplImage* dst = cvCreateImage(cvGetSize(img),img->depth,1);
cvNamedWindow("GRAY");
cvCvtColor(img,dst,CV_BGR2GRAY);
int height = dst->height;
int width = dst->width;
int step = dst->widthStep;
int channels = dst->nChannels;
uchar *data = (uchar *)dst->imageData;
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){
for(int k=0;k<channels;k++){
if(data[i*step+j*channels+k]<210)data[i*step+j*channels+k]=255;
else data[i*step+j*channels+k]=0;
}
}
}
while(1){
cvShowImage("GRAY",dst);
if(cvWaitKey())break;
}
cvReleaseImage(&img);
return 0;
}
实验2014062701:opencv对图像的点操作,布布扣,bubuko.com
标签:color width 2014 for window amp
原文地址:http://www.cnblogs.com/experiments-of-ORLAN/p/3812860.html