Ask Your Question
0

Ubuntu destroyAllWindows bug?

asked 2014-07-09 08:45:38 -0600

thdrksdfthmn gravatar image

I am using OpenCV on Ubuntu 14.04. When I call the destroyAllWindows() functions It closes all the windows in which there were displayed images, but it still remains in the side-bar (see picture below):

image description

I call the imshow() function in more classes functions and I am getting this problem. I have tried to simulate it in a simple for loop, but it is not doing the same. I think the problem is in my code. It is too big to post it all, so any suggestions why this may happen?

As a parenthesis: I have some kind of object displayer and in it I am doing a display image function and a close all window function:

class Displayer
{
public:
  Displayer() {}
  ~Displayer() {}

  void displayImg(const cv::Mat& image, const std::string& name, bool flg)
  {
    if (flg)
    {
      cv::imshow(wnm, m);
      cv::waitKey();
    }
  }

  void closeAllWindows() { cv::destroyAllWindows(); }
};

I am using it for easier display, not display, based on that flag. It is true that I create more than one object, could it be because of that?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-07-09 09:52:29 -0600

I guess you should call it once per application, not for every object (otherwise you try to destroy windows in other objects, and it's unspecified).

edit flag offensive delete link more

Comments

1

Aham, that is it

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-07-09 10:13:08 -0600 )edit

Like he said, didnt know that and had the same problem ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-09 11:43:02 -0600 )edit
0

answered 2014-07-09 09:46:21 -0600

thdrksdfthmn gravatar image

No, not a bug! It was my fault: because of the many Displayer objects. I have fixed it by doing a copy constructor and pass the object from one class to another, not it is only one group of displaying windows and no more empty groups. Sorry about that

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-07-09 08:45:38 -0600

Seen: 656 times

Last updated: Jul 09 '14