recreating_windows.cpp
1 | /*!
|
---|---|
2 | * @file recreating_windows.cpp |
3 | * @brief https://code.ros.org/trac/opencv/ticket/1538 |
4 | * |
5 | * Description: |
6 | * I'm writing a C++ program, with CodeBlocks?, wxWidgets and OpenCV 2.3.1. |
7 | * It's running in Windows 7. When I compile in Debug mode, I can create |
8 | * windows with namedWindow function, destroy it with destroyWindow and |
9 | * re-create again. I think that is the way it should work. |
10 | * But, when I compile in Release mode the windows don't show after |
11 | * re-creating. The program acts as if the window is there, but nothing |
12 | * appear in the screen. |
13 | * |
14 | * I don't know if this is a bug, or if I shouldn't destroy windows like that. |
15 | * Sorry if my english is poor, and best regards. |
16 | * |
17 | * @author Luis Diaz Mas (LDM), [email protected] |
18 | * |
19 | * @internal |
20 | * Created 09/01/12 |
21 | * Revision 01/09/12 - 19:15:37 |
22 | * Compiler gcc/g++ |
23 | * |
24 | * This source code is released for free distribution under the terms of the |
25 | * GNU General Public License as published by the Free Software Foundation. |
26 | */ |
27 | |
28 | #include <cstdlib> |
29 | #include <opencv2/core/core.hpp> |
30 | #include <opencv2/highgui/highgui.hpp> |
31 | |
32 | using namespace cv; |
33 | |
34 | int main ()
|
35 | { |
36 | Mat img(Size(640,480), CV_8UC1, Scalar(0)); |
37 | |
38 | bool endApp=false; |
39 | char key=0; |
40 | while(endApp==false) |
41 | { |
42 | namedWindow("img");
|
43 | imshow("img", img);
|
44 | key = waitKey(); |
45 | if (key==27) |
46 | endApp=true;
|
47 | destroyWindow("img");
|
48 | } |
49 | |
50 | return EXIT_SUCCESS;
|
51 | } // ---------- end of function main ----------
|