Repository: opencv
Issue: some 4.0.0.1 examples show grey empty blank highgui GTK 2 and GTK 3 windows on armhf Debian Stretch
Labels: priority: low,category: highgui-gui,platform: arm

- OpenCV => 4.0.0.1
- Operating System / Platform => armhf Linux 32 Bit kernel (Raspberry pi3B+)
- Compiler => gcc

- OpenCV => :grey_question: GTK window renders no example content, but opengl example does
- Operating System / Platform => :grey_question: window blips content if moved
- Compiler => :grey_question: can't disable VTK for build

Display bug GTK window renders no example content:
test1: disable openGL, with gtk  3.22.11
test2: with openGL, with gtk  2.x
test3: with openGL, with gtk  2.x, disable  opencl, disable carotene

notes:
1. for each test I tried both the marco gpu and software desktop compositors. 
2. cpp_lkdemo video content seems to blip a camera frame on being dragged
3. opengl_interop seems show video feed (openCL mode with throw errors, but that is expected for the flags i used)

Current test3 build (dirty due to CMake platform specific path includes):
```
-- General configuration for OpenCV 4.0.1-dev =====================================
--   Version control:               4.0.1-340-ga1ef61266-dirty
-- 
--   Extra modules:
--     Location (extra):            /home/pi/SRC/opencv_contrib/modules
--     Version control (extra):     33f18dd-dirty
-- 
--   Platform:
--     Timestamp:                   2019-03-11T00:36:12Z
--     Host:                        Linux 4.14.52-rt34-v7+ armv7l
--     CMake:                       3.7.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   CPU/HW features:
--     Baseline:                    VFPV3 NEON
--       requested:                 DETECT
--       required:                  VFPV3 NEON
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 6.3.0)
--     C++ flags (Release):         -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -fvisibility=hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -fvisibility=hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          /usr/local/caffe/lib/libcaffe.so /usr/lib/arm-linux-gnueabihf/libglog.so /usr/local/lib/libprotobuf.so dl m pthread rt /usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib cnn_3dobj core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc java java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv js matlab ovis
--     Applications:                tests perf_tests examples apps
--     Documentation:               NO
--     Non-free algorithms:         YES
-- 
--   GUI: 
--     GTK+:                        YES (ver 2.24.31)
--       GThread :                  YES (ver 2.50.3)
--       GtkGlExt:                  YES (ver 1.2.0)
--     OpenGL support:              YES (/usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so)
--     VTK support:                 YES (ver 6.3.0)
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver 62)
--     WEBP:                        /usr/lib/arm-linux-gnueabihf/libwebp.so (ver encoder: 0x0209)
--     PNG:                         /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
--     TIFF:                        build (ver 42 - 4.0.10)
--     JPEG 2000:                   /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib/arm-linux-gnueabihf/libImath.so /usr/lib/arm-linux-gnueabihf/libIlmImf.so /usr/lib/arm-linux-gnueabihf/libIex.so /usr/lib/arm-linux-gnueabihf/libHalf.so /usr/lib/arm-linux-gnueabihf/libIlmThread.so (ver 2.2.0)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.64.101)
--       avformat:                  YES (57.56.101)
--       avutil:                    YES (55.34.101)
--       swscale:                   YES (4.2.100)
--       avresample:                YES (3.1.0)
--     GStreamer:                   YES (1.10.4)
--     v4l/v4l2:                    YES (linux/videodev2.h)
-- 
--   Parallel framework:            TBB (ver 4.3 interface 8006)
-- 
--   Trace:                         YES (built-in)
-- 
--   Other third-party libraries:
--     Lapack:                      YES (/usr/lib/libopenblas.so)
--     Eigen:                       YES (ver 3.2.10)
--     Custom HAL:                  NO
--     Protobuf:                    /usr/local/lib/libprotobuf.so (3.7.0)
-- 
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.13)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
--     numpy:                       /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.15.3)
--     install path:                lib/python2.7/dist-packages/cv2/python-2.7
-- 
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.3)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
--     install path:                lib/python3.5/dist-packages/cv2/python-3.5
-- 
--   Python (for build):            /usr/bin/python2
--     Pylint:                      /usr/bin/pylint (ver: 1.6.5, checks: 168)
--     Flake8:                      /usr/bin/flake8 (ver: 3.2.1)
-- 
--   Java:                          
--     ant:                         /usr/bin/ant (ver 1.9.9)
--     JNI:                         /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
--     Java wrappers:               YES
--     Java tests:                  YES
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
    ```

Current build steps:
 ```
#note: version 3.5 included in opencv repo will fail to build
#protobuf 3,7.0
cd ~/SRC
git clone --depth 1 https://github.com/protocolbuffers/protobuf.git
cd ~/SRC/protobuf
 git submodule update --init --recursive
 ./autogen.sh
 ./configure 
 make
sudo  make install 
sudo ldconfig

#caffe
cd /usr/lib/arm-linux-gnueabihf
sudo ln -s libhdf5_serial.so.100.0.1 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.100.0.0 libhdf5_hl.so

cd ~/SRC/caffe/python
for req in $(cat requirements.txt); do sudo pip install $req; done
git clone --depth 1 https://github.com/BVLC/caffe.git caffe_head
cd ~/SRC/caffe_head/
mkdir -p ~/SRC/caffe_head/build
cd ~/SRC/caffe_head/build
cmake -D CPU_ONLY=1 -D USE_OPENCV=0 -D CMAKE_INSTALL_PREFIX=/usr/local/caffe ..
make all
make pycaffe
sudo make install
sudo ldconfig

#disable  opencl carotene 
cmake -D BUILD_TIFF=ON \
-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/pi/SRC/opencv_contrib/modules \
-D_GLIBCXX_USE_CXX11_ABI=0 -D WITH_UNICAP=ON -D BLAS=open \
-D WITH_MATLAB=OFF -D WITH_QT=OFF -D WITH_TESTS=OFF  -D ENABLE_PRECOMPILED_HEADERS=OFF  \
-D BUILD_opencv_gpulegacy=OFF \
	-D INSTALL_PYTHON_EXAMPLES=ON \
	-D INSTALL_C_EXAMPLES=ON \
	-D BUILD_EXAMPLES=ON \
	-D OPENCV_ENABLE_NONFREE=ON \
-D WITH_CAFFE=ON -D BUILD_CAFFE=OFF -D Caffe_LIBS=/usr/local/caffe/lib/libcaffe.so  -D Caffe_INCLUDE_DIR=/usr/local/caffe/include \
-D WITH_CERES=ON  -D BUILD_CERES=OFF -D CERES_LIBS=/usr/local/lib/libceres.a  -D CERES_INCLUDE_DIR=/usr/local/include \
	-D Atlas_LAPACK_LIBRARY=/usr/lib/liblapack.so \
	-D ATLAS_INCLUDE_DIR==/usr/include/atlas/ \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D CMAKE_CXX_FLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0" \
-D WITH_GTK=ON  -DWITH_GTK_2_X=ON \
-D WITH_OPENGL=ON \
-D WITH_CAROTENE=OFF -D WITH_VTK=ON -D WITH_OPENCL=OFF -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_VA_INTEL=OFF \
-D ocv_add_testdata=ON \
-D CPACK_BINARY_DEB=ON \
 -D PROTOBUF_UPDATE_FILES=ON  \
 -D BUILD_PROTOBUF=OFF  \
 -D PROTOBUF_MIN_PROTOC_VERSION=3004000 \
 -D PROTOBUF_LIBRARY=/usr/local/lib/libprotobuf.so \
 -D PROTOBUF_LITE_LIBRARY=/usr/local/lib/libprotobuf-lite.so \
 -D PROTOBUF_PROTOC_EXECUTABLE=/usr/local/bin/protoc \
 -D Protobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc \
 -D PROTOBUF_PROTOC_LIBRARY=/usr/local/lib/libprotoc.so \
 -D Protobuf_LIBS=/usr/local/lib/libprotobuf.so \
-D PYTHON2_INCLUDE_DIR2=/usr/local/caffe/include \
-D PYTHON3_INCLUDE_DIR2=/usr/local/caffe/include \
-D PYTHON_DEFAULT_EXECUTABLE=$(which python2) \
-D BUILD_opencv_python2=ON \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON  -D BUILD_opencv_dnn=ON \
-D BUILD_opencv_world=OFF -D BUILD_opencv_cnn_3dobj=ON \
-D WITH_EIGEN=ON  -D BUILD_opencv_gs=ON -D BUILD_opencv_ovis=ON -D BUILD_opencv_gpu=ON \
-D BUILD_opencv_gpuarithm=ON  -D BUILD_opencv_gpubgsegm=ON -D BUILD_opencv_gpucodec=ON \
-D BUILD_opencv_gpufeatures2d=ON -D BUILD_opencv_gpufilters=ON -D BUILD_opencv_gpuimgproc=ON  \
-D BUILD_opencv_gpuoptflow=ON -D BUILD_opencv_gpustereo=ON -D BUILD_opencv_gpuwarping=ON \
-D WITH_OPENMP=ON -D WITH_TBB=ON -D WITH_V4L=ON  \
-D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=ON    
    ```