opencv--用鼠标动态改变显示图像窗口大小
2010-12-24 21:51
1046 查看
Code:
// 缩小图像.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
const double scale = 0.5;
IplImage* ResizeImage(IplImage *src)
{
// allocate memory for the dsc
IplImage* dsc = cvCreateImage(cvSize(src->width*scale, src->height*scale),
src->depth, src->nChannels);
// resizes Image(input array is resized to fit the output array )
cvResize(src, dsc, CV_INTER_LINEAR);
return dsc;
}
int main(int argc, char* argv[])
{
// load image
IplImage *src = cvLoadImage("e://lena.jpg", CV_LOAD_IMAGE_COLOR);
IplImage *dsc = NULL;
//
dsc = ResizeImage(src);
// create the window to shou image
// be carefull the follow function's 2 parameter
cvNamedWindow("src", 1);
cvNamedWindow("dsc", 0);
// show the image when the window changes
// and you can use the mouse the changes the window's size
cvResizeWindow("src", src->width, src->height);
cvResizeWindow("dsc", dsc->width, dsc->height);
// print image to the windows
cvShowImage("src", src);
cvShowImage("dsc", dsc);
// waiting a keyboard
cvWaitKey(0);
// release the memory
cvDestroyAllWindows();
cvReleaseImage(&src);
cvReleaseImage(&dsc);
printf("Hello World!/n");
return 0;
}
// Remark: when creat window we should make the 2 parameter of
// cvNamedWindow function is 0
// 缩小图像.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
const double scale = 0.5;
IplImage* ResizeImage(IplImage *src)
{
// allocate memory for the dsc
IplImage* dsc = cvCreateImage(cvSize(src->width*scale, src->height*scale),
src->depth, src->nChannels);
// resizes Image(input array is resized to fit the output array )
cvResize(src, dsc, CV_INTER_LINEAR);
return dsc;
}
int main(int argc, char* argv[])
{
// load image
IplImage *src = cvLoadImage("e://lena.jpg", CV_LOAD_IMAGE_COLOR);
IplImage *dsc = NULL;
//
dsc = ResizeImage(src);
// create the window to shou image
// be carefull the follow function's 2 parameter
cvNamedWindow("src", 1);
cvNamedWindow("dsc", 0);
// show the image when the window changes
// and you can use the mouse the changes the window's size
cvResizeWindow("src", src->width, src->height);
cvResizeWindow("dsc", dsc->width, dsc->height);
// print image to the windows
cvShowImage("src", src);
cvShowImage("dsc", dsc);
// waiting a keyboard
cvWaitKey(0);
// release the memory
cvDestroyAllWindows();
cvReleaseImage(&src);
cvReleaseImage(&dsc);
printf("Hello World!/n");
return 0;
}
// Remark: when creat window we should make the 2 parameter of
// cvNamedWindow function is 0
相关文章推荐
- mfc动态改变对话框窗口大小和显示位置
- MFC动态改变对话框窗口大小和显示位置
- mfc动态改变对话框窗口大小和显示位置
- Java OpenCV开发——使用JavaCV在窗口显示图像,并监听鼠标点击事件
- DHTML技术演示---动态设置表格行间隔显示、表格排序、鼠标悬停样式改变
- opencv图像resize(改变图片大小)
- 新 OpenCV 多幅图像 同一个窗口 显示 代码优化版
- java中 实现无标题无边框的窗体能够用鼠标拖动改变窗口大小
- MFC中用OpenCV显示图像,并跟踪鼠标显示图像的坐标与像素
- javascript动态改变窗口大小
- JavaScript | 鼠标悬停动态弹出浮动窗口显示图片 | clientX, clientY, scrollLeft, scrollTop
- Opencv窗口显示图像的时候设置字体
- SWT中显示图片并随窗口改变其大小
- 利用opencv将两张图像在同一窗口上显示,并在图片上显示文字
- 利用OpenCV鼠标控制窗口大小
- opencv动态显示图像像素值
- Opencv显示图片的窗口大小
- 创建画线控件窗口大小改变引起的重绘,保存图像问题。
- jQuery动态改变图片显示大小(修改版)的实现思路及代码
- MFC 以图像大小打开并显示图像,鼠标左击显示像素坐标