Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6074431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:22:52+00:00 2026-05-23T10:22:52+00:00

I want to display an image in OpenCV in a full screen borderless window.

  • 0

I want to display an image in OpenCV in a full screen borderless window.
In other words, only the image pixels will appear, without menu, toolbar, or window background.

Using imshow() or cvShowImage() don’t enable it:

  1. The window grows to be full screen
    in width but not in height. It misses few pixels.
  2. I could not make it borderless even by changing settings of window
    handler.

I think that the problem is rooted in cvNamedWindow() method which creates main WS_OVERLAPPED window, then creates a child and all functions like imshow() or cvGetWindowHandle() operate on the child.

Thus even windows command:

SetWindowLong((HWND)cvGetWindowHandle(winName), GWL_STYLE, WS_VISIBLE | WS_EX_TOPMOST | WS_POPUP);

Doesnt help, since the child cannot become borderless WS_POPUP. Someone got a workaround?

  • Maybe, showing opencv mat to window
    without using opencv built in methods
  • Or some kind of windows trick

P.S. I tried the following code:

cvMoveWindow("AAA",0,0);
cvSetWindowProperty("AAA", CV_WINDOW_FULLSCREEN, CV_WINDOW_FULLSCREEN);

// Also I tried this:
HWND hwnd = (HWND)cvGetWindowHandle("AAA");
RECT windowRect;
windowRect.left = 0;
windowRect.top = 0;
windowRect.right = cxScreen; //Display resolution
windowRect.bottom = cyScreen; //Display resolution
AdjustWindowRect(&windowRect,WS_VISIBLE,false);
long p_OldWindowStyle = SetWindowLongPtr(hwnd,GWL_STYLE,WS_POPUP);
SetWindowPos(hwnd,HWND_TOP,0,0,windowRect.right,windowRect.bottom,SWP_FRAMECHANGED | SWP_SHOWWINDOW);
SetWindowLong(hwnd, GWL_STYLE, WS_VISIBLE | WS_EX_TOPMOST | WS_POPUP); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:22:52+00:00Added an answer on May 23, 2026 at 10:22 am

    Have you issued cvShowImage() to display the window? Because it seems you are not doing it. Anyway, you might want to call the win32 API for this instead, so add a call to ShowWindow(hwnd, SW_SHOW); after SetWindowPos().

    If your current call to SetWindowPos() doesn’t do the trick, check this answer: Hide border of window, if i know a handle of this window

    I recommend you doing your tests without calling cvSetWindowProperty() at first, just to make sure you can find a method that works.

    Just a note, if you check modules/highgui/src/window_w32.cpp you can see how OpenCV creates windows on Windows.

    EDIT:

    The following code implements the tips I gave before and bypasses the problems the OP reported. The trick is NOT using cvGetWindowHandle() to retrieve the windows’ handle and use directly win32 API for that: FindWindow()

    IplImage* cv_img = cvLoadImage("test.jpg", CV_LOAD_IMAGE_UNCHANGED);
    if(!cv_img)
    {
        printf("Failed cvLoadImage\n");
        return -1;
    }
    
    cvNamedWindow("main_win", CV_WINDOW_AUTOSIZE);
    cvMoveWindow("main_win", 0, 0);
    cvSetWindowProperty("main_win", CV_WINDOW_FULLSCREEN, CV_WINDOW_FULLSCREEN);
    
    cvShowImage("main_win", cv_img);
    
    //HWND cv_hwnd = (HWND)cvGetWindowHandle("main_win");
    //if (!cv_hwnd)
    //{
    //  printf("Failed cvGetWindowHandle\n");
    //}
    //printf("cvGetWindowHandle returned %p\n", *cv_hwnd);
    
    HWND win_handle = FindWindow(0, L"main_win");
    if (!win_handle)
    {
        printf("Failed FindWindow\n");
    }
    
    SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
    ShowWindow(win_handle, SW_SHOW);
    
    cvWaitKey(0);
    
    cvReleaseImage(&cv_img);
    cvDestroyWindow("main_win");
    

    This code will make the window created by OpenCV borderless, but you still might have to tweak one thing or another to make this operation perfect. You’ll see why. One idea is to resize the window and make it the size of the image.

    EDIT:

    Well, since you stated:

    writing a demo might be very hard

    I also decided to do this last part for you, since I’m such a nice guy =]

    This is a small improvement of the code above:

    HWND win_handle = FindWindow(0, L"main_win");
    if (!win_handle)
    {
        printf("Failed FindWindow\n");
    }
    
    // Resize
    unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
    flags &= ~SWP_NOSIZE;
    unsigned int x = 0;
    unsigned int y = 0;
    unsigned int w = cv_img->width;
    unsigned int h = cv_img->height;
    SetWindowPos(win_handle, HWND_NOTOPMOST, x, y, w, h, flags);
    
    // Borderless
    SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
    ShowWindow(win_handle, SW_SHOW);
    

    And on my system it displays exactly what you asked on the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display an image in iPhone application on the whole screen but
Suppose there is a frame with some image.I want to display only those parts
I want to display image using base64 encoding in IE using GWT If it
I want to display an image within a scroll area. The view port of
I want to display an image at 'true size' in my application. For that
I want to display .jpg image in an Qt UI. I checked it online
If I want to display an image in my webpage and its src is
I want to display a thumbnail image in a cell of tableViewController , this
I want to display a simple GIF image in a VBox using GTK+ from
I want to display a png with flex's builtin image component. There's a specific

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.