如何显示带有窗口大小不同的输出图像? [英] How can I display output image with difference size of window?
本文介绍了如何显示带有窗口大小不同的输出图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用OpenCV函数在窗口上显示图像。但是,我试图显示图像的任何时候将适合显示器的大小(如示例中所示)。
I would like to display an image on window using OpenCV function. However, anytime that I tried to display image will be fit to the size of display (as show in the example).
如果我想显示一个有差异的图像窗口大小(例如,窗口大小为1280x960像素,图像为600x600像素,偏移坐标为100x100像素)。
If I would like to display an image with difference size of window (for example. window size 1280x960px, and an image is 600x600px at offset coordinate 100x100px) How can I make them?
对不起,我是OpenCV的初学者对不起,我的英语不好。
Sorry that I am beginner of OpenCV and Sorry for my poor English.
感谢您的帮助。 :)
>
推荐答案
我只是做一个更大的空白图像,并将实际图像放在其中:
I'd just make a bigger empty image and place the actual image in there using:
IplImage* smallerImage = cvLoadImage("image.jpg",1)
IplImage* biggerImage = cvCreateImage(cvSize(1280,960),8,3);
cvSetImageROI(biggerImage,cvRect(100,100,800,600);
cvResize(smallerImage,biggerImage);
cvResetImageROI(biggerImage);
cvShowImage("result",biggerImage);
这篇关于如何显示带有窗口大小不同的输出图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文