使用imshow opencv将图像拟合到屏幕 [英] Fitting an image to screen using imshow opencv

查看:261
本文介绍了使用imshow opencv将图像拟合到屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Mac OS X 13'上使用opencv显示图像.图像尺寸为1920××1080.运行此代码时,我只能看到图像的一部分.我需要使图像适合屏幕.

I want to display an image using opencv on Mac os X 13'. The image size is 1920 × 1080. When I run this code, I see just a part of an image. I need to fit the image to the screen.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include "opencv2/opencv.hpp"
#include<string.h>
using namespace cv;
using namespace std;

int main()
{
   Mat image=imread("/Users/rafikgouiaa/Qt/projects/MakeVideo/build-MakeVideo-    Desktop_Qt_5_0_2_clang_64bit-Debug/im.jpg");
   namedWindow( "Display frame",CV_WINDOW_AUTOSIZE);
   imshow("Display frame", image);
   waitKey(0);
   return 0
}

推荐答案

如果需要显示大于屏幕分辨率的图像,则需要调用

If you need to show an image that is bigger than the screen resolution, you will need to call

namedWindow("Display frame", WINDOW_NORMAL)

在展示之前.

要设置所需的窗口调用大小

To set desirable size of the window call please

cv::resizeWindow("Display frame", WIDTH, HEIGHT);

有关更多详细信息,请参见 http://docs.opencv.org/modules/highgui/doc /user_interface.html#imshow

For more details see http://docs.opencv.org/modules/highgui/doc/user_interface.html#imshow

这篇关于使用imshow opencv将图像拟合到屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆