//环境:VS2010 + OpenCV 2.3.1
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
Mat src, dst, tmp;
char* window_name = "Pyramids Demo";
int _tmain(int argc, _TCHAR* argv[])
{
printf("\n Zoom In-Out demo \n");
printf("-------------------- \n");
printf("*[u]-> Zoom in \n");
printf("*[d]-> Zoom out \n");
printf("*[ESC]-> Close program \n\n");
src = imread("D:\\fruits.jpg");
if(!src.data)
{
printf("No data!--Exiting the program \n");
return -1;
}
tmp = src;
dst = tmp;
namedWindow(window_name,CV_WINDOW_AUTOSIZE);
imshow(window_name,dst);
while(true)
{
int c;
c = waitKey(10);
if((char)c == 27)
{
break;
}
if((char)c == 'u')
{
pyrUp(tmp,dst,Size(tmp.cols * 2,tmp.rows * 2));
printf("** Zoom In:Image x 2\n");
}
else if((char)c == 'd')
{
pyrDown(tmp,dst,Size(tmp.cols / 2,tmp.rows / 2));
printf("**Zoom Out:Image / 2\n");
}
imshow(window_name,dst);
tmp = dst;
}
return 0;
}
#pragma comment(lib,"opencv_highgui231d.lib")
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有