《学习OpenCV》第三章练习(参考代码)第6题

#include<cv.h>
#include<highgui.h>

int main(int argc, char** argv){
	IplImage* img = cvLoadImage("E:\\1.jpg", 1);
	IplImage* header0 = cvCreateImageHeader(cvSize(20, 30), img->depth, img->nChannels);
	IplImage* header1 = cvCreateImageHeader(cvSize(20, 30), img->depth, img->nChannels);
	header0->origin = img->origin;
	header1->origin = img->origin;
	header0->widthStep = img->widthStep;
	header1->widthStep = img->widthStep;

	header0->imageData = img->imageData + 10*img->widthStep + 5*img->nChannels;
	header1->imageData = img->imageData + 60*img->widthStep + 50*img->nChannels; 

	cvNot(header0, header0);
	cvNot(header1, header1);

	cvNamedWindow("Exercise3_6", CV_WINDOW_AUTOSIZE);
	cvShowImage("Exercise3_6", img);
	cvWaitKey(0);
	cvReleaseImage(&img);
	cvReleaseImageHeader(&header0);
	cvReleaseImageHeader(&header1);
	cvDestroyWindow("Exercise3_6");
}



你可能感兴趣的:(opencv,opencv,练习,learning,答案,第三章,学习OpenCV,第6题,第六题,课后习题答案)