图像缩放

高深的搞不动了搞些简单的

// Gauss.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "cv.h"
#include "highgui.h"
#include ;
#include 
using namespace std;
void resizeImage(IplImage * src,IplImage *dst,bool largescale);
int _tmain(int argc, _TCHAR* argv[])
{

	clock_t clkbegin;
	clock_t clkend;
	IplImage * src =cvLoadImage("D:/lena.jpg");

	 IplImage*dst= cvCreateImage(cvSize(src->width/2,src->height/2),src->depth,3);
	 clkbegin=clock();
	  resizeImage(src,dst,0);
	  clkend=clock();
	  cout<height;
	int cols;cols = src->width;
#define Imr(ROW,COL) ((uchar*)(src->imageData+(ROW)*src->widthStep))[(COL)*src->nChannels+0]
#define Img(ROW,COL) ((uchar*)(src->imageData+(ROW)*src->widthStep))[(COL)*src->nChannels+1]
#define Imb(ROW,COL) ((uchar*)(src->imageData+(ROW)*src->widthStep))[(COL)*src->nChannels+2]
#define newImr(ROW,COL) ((uchar*)(dst->imageData+(ROW)*dst->widthStep))[(COL)*dst->nChannels+0]
#define newImg(ROW,COL) ((uchar*)(dst->imageData+(ROW)*dst->widthStep))[(COL)*dst->nChannels+1]
#define newImb(ROW,COL) ((uchar*)(dst->imageData+(ROW)*dst->widthStep))[(COL)*dst->nChannels+2]
	if(!largescale)
	{
	  //降采样;
		cout<<"缩小图像"<


你可能感兴趣的:(C/C++学习,学习opencv)