2

I just wonder has anybody fixed this issue. I've read all post but found no answers. The problem is: there is a python simple code

import cv2

cam = cv2.VideoCapture(0)

cv2.namedWindow('test', cv2.WINDOW_NORMAL)

while True:
    ret, img = cam.read()
    if ret:
        print img.mean()
        cv2.imshow('test', img)

    cv2.waitKey(1)

When I run it I see only a window title bar with no content underneath. But frames keep updating that I can see on terminal with img.mean() printout. Since I set cv2.WINDOW_NORMAL I can grab the window corner and drag it and I see the frame content but at this time frames stop updating. When I release the window corner the window collapses back and frames start updating again.

If I use any other image display functions e.g. dlib.image_window() in my case everything works just fine.

I use opencv 3.2.0-dev compiled from sources with opencv_contrib and python 2.7.13 on MacOS

Screenshot

Problem solved

The solution is: in file opencv/modules/highgui/src/window_cocoa.mm change

@implementation CVView
#if defined(__LP64__)
@synthesize image;
#else // 32-bit Obj-C does not have automatic synthesize
@synthesize image = _image;
#endif

to

@implementation CVView
@synthesize image = _image;

The explanation is here

@DanMašek, thanks for your comment that made my life easier )

Community
  • 1
  • 1
szhernovoy
  • 31
  • 4
  • When you say that you see the frame content, is the frame stuck to some bottom-left corner? That's how it was in another one of the threads with these issues, wondering if it's a common theme. For now, have you tried setting the window size with [`cv2.resizeWindow()`](http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html#resizewindow)? Not sure if that will help. You can use it after you create the named window. – alkasm Jun 27 '17 at 13:16
  • @AlexanderReynolds, doesn't help either. – szhernovoy Jun 27 '17 at 14:11
  • @DanMašek, attached. Thanks, will try to patch window_cocoa.mm and recompile as your link suggests – szhernovoy Jun 27 '17 at 14:11

0 Answers0