OpenCV imshow not displaying image in osx

前端 未结 1 1690
终归单人心
终归单人心 2020-12-04 04:03

I\'m working right out of a book, and copied the following code (essentially the openCV equivalent of \"hello world\"):

//helloCV.cpp
#include 

        
相关标签:
1条回答
  • 2020-12-04 04:19

    Thanks to @DanMašek for the lead on this one, and to all the people on this page: http://answers.opencv.org/question/160201/video-window-not-loading-frame/

    To repeat what they said, what worked for me was the following:

    To resolve this, locate the file window_cocoa.mm; if built from source it'll be in opencv/modules/highgui/src.

    Change the following:

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

    To this:

    @implementation CVView
    @synthesize image = _image;
    

    Do the same thing for the CVWindow and CVSlider implementations to accommodate videos as well.

    Recompile OpenCV and test out your code.

    Hope this helps other people struggling with this issue!

    0 讨论(0)
提交回复
热议问题