?? test.cpp
字號(hào):
#include <cv.h>
#include <highgui.h>
#include <math.h>
int main( int argc, char** argv )
{
CvPoint center;
double scale=-3;
IplImage* image =
cvLoadImage(argc == 2 ? argv[1] : "lena.jpg");
if(!image) return -1;
center = cvPoint(image->width/2,image->height/2);
for(int i=0;i<image->height;i++)
for(int j=0;j<image->width;j++)
{
double dx=(double)(j-center.x)/center.x;
double dy=(double)(i-center.y)/center.y;
double weight=exp((dx*dx+dy*dy)*scale);
uchar* ptr = &CV_IMAGE_ELEM(image,uchar,i,j*3);
ptr[0] = cvRound(ptr[0]*weight);
ptr[1] = cvRound(ptr[1]*weight);
ptr[2] = cvRound(ptr[2]*weight);
}
cvNamedWindow( "test", 1 );
cvShowImage( "test", image );
cvWaitKey();
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -