OPenCV学习笔记(5)——图像缩放
2016-06-30 17:29
337 查看
将图像缩放为原来的1/2:
#include "opencv/cv.h"
#include "opencv/highgui.h"
int main(int argc,char** argv)
{
IplImage* in = cvLoadImage(argv[1]);//载入图像
cvNamedWindow("IN",1);
cvNamedWindow("OUT",1);
cvShowImage( "IN", in );
// Best to make sure input image is divisible by two.
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
cvShowImage( "OUT", out );
cvWaitKey(0);
cvReleaseImage(&out);
cvReleaseImage(&in);
cvDestroyWindow("IN");
cvDestroyWindow("OUT");
return 0;
}
缩放前后的图像:
#include "opencv/cv.h"
#include "opencv/highgui.h"
int main(int argc,char** argv)
{
IplImage* in = cvLoadImage(argv[1]);//载入图像
cvNamedWindow("IN",1);
cvNamedWindow("OUT",1);
cvShowImage( "IN", in );
// Best to make sure input image is divisible by two.
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
cvShowImage( "OUT", out );
cvWaitKey(0);
cvReleaseImage(&out);
cvReleaseImage(&in);
cvDestroyWindow("IN");
cvDestroyWindow("OUT");
return 0;
}
缩放前后的图像:
相关文章推荐
- 初学mysql & python & python链接数据库(mysql) & mysql for linux
- Linux SSH远程文件/目录传输命令scp
- CentOS7配置samba共享服务
- solr 6.1 服务端 tomcat 搭建及调用
- centos7mysql5.6.30单机多实例配置主主复制
- Mybatis读取 加密DB.properties 重写 PropertyPlaceholderConfigurer
- OpenGL学习进程(5)第三课:视口与裁剪区域
- Linux查看性能
- Linux Centos 6.6安装Mysql
- OpenCV系统学习:一、OpenCV结构、基本数据类型
- Ubuntu下快速安装Nginx
- Linux定时任务Crontab详解
- iOS开发常用国外网站清单
- 展示模式架构比较MVP(SC),MVP(PV),PM,MVVM和MVC
- opencv访问图像
- CentOS7下解决yum install mysql-server没有可用包的问题
- 想转行做运营人?这些事 你要知道
- [嵌入式Linux]--arm交叉编译器gnueabi、none-eabi、arm-eabi、gnueabihf、gnueabi区别
- Linux 一些常用工具软件
- Linux命令--hostname