Skip to content

BUG: The current event queue and the main event queue are not the same.... #7474

Closed
@subokita

Description

@subokita
System information (version)
  • OpenCV => 3.1.0
  • Operating System / Platform => Mac OSX El Capitan 10.11.6 (Also in Mac OSX Sierra)
  • Compiler => clang
Detailed description

Running a C++ program using OpenCV3 throws out the following message:

BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.

The OpenCV3 is installed thru homebrew

Steps to reproduce
  • First the installation of opencv3 is done using homebrew, to zero-in the bug, I've also tried to uninstall all other dependencies first:
brew uninstall --force tbb
brew uninstall --force ffmpeg
brew uninstall --force python3
brew uninstall --force libtiff
brew uninstall --force libpng
brew uninstall --force opencv3
brew install opencv3 --HEAD --c++11
brew link --overwrite --force opencv3
  • Second after compiling my C++ program using CMake and Make, I try to run it, which leads to the
    following message: BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.

Here's the simple C++ program:

int main(int argc, const char * argv[]) {
    string video_filename = "./IMG_0879.m4v";
    VideoCapture capture = VideoCapture(video_filename);

    string image_filename = "./IMG_0879.jpg";
    Mat image = imread(image_filename);
    namedWindow("");
    imshow("", image);
    waitKey(10);
    return 0;
}

Activity

subokita

subokita commented on Oct 18, 2016

@subokita
Author

Seems to be fixed by reinstalling opencv3 with --with-ffmpeg flag.

mshabunin

mshabunin commented on Oct 18, 2016

@mshabunin
Contributor

Looks like there is no problem in OpenCV. Feel free to reopen if you have more information.

KleinYuan

KleinYuan commented on Oct 23, 2016

@KleinYuan

Run into similar issue when working with openCV (2.4.13) and python (2.7.12) on fresh new Mac (macOS 10.12).
Use pycharm community IDE to run an algorithm I developed (same code running without no problem on another mac OS X10.11.6, python 2.7.12, openCV 2.4.13).

here's the error:

2016-10-22 17:34:42.733 Python[4882:255026] 
!!! BUG: The current event queue and the main event queue are not the same. 
Events will not be handled correctly. 
This is probably because _TSGetMainThread was called for the first time off the main thread.

Also, same solution.

It's because ffmpeg was not installed together with OpenCV. Reinstalled with that flag solved this issue.

relikd

relikd commented on Jan 22, 2017

@relikd

Same issue here. Can you give me a quick walkthrough on how to reinstall OpenCV with mentioned flag?

I have tried an install with CMake GUI and with this instructions.

However I get:

Can't find ffmpeg - 'pkg-config' utility is missing
  ...
  Video I/O:
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      NO
      avcodec:                   NO
      avformat:                  NO
      avutil:                    NO
      swscale:                   NO
      avresample:                NO
    ...

( ffmpeg Mac package is installed)

bharath063

bharath063 commented on Feb 22, 2017

@bharath063

@subokita Can you provide us with the steps to compile with ffmpeg on Sierra?

relikd

relikd commented on Feb 22, 2017

@relikd

@bharath063 It worked for me with homebrew:

brew install ffmpeg
brew tap homebrew/science
brew install --HEAD opencv --with-ffmpeg

bharath063

bharath063 commented on Feb 22, 2017

@bharath063

@relikd Thanks! But I had faced an issue when installing opencv through homebrew on sierra because of the QTKit deprecation. So I had followed this -> http://www.pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/ tutorial to compile from source.

abdullahselek

abdullahselek commented on Jun 11, 2017

@abdullahselek

Thanks @relikd this also worked for me.

tpmeyer1

tpmeyer1 commented on Nov 25, 2017

@tpmeyer1

@relikd
It didn't work for me! I have Mac OS X El Capitan. Running python 3.6.3
When I tried using the --HEAD flag, it failed, so I ran without the flag. cut-and-paste below:

Thomass-iMac:bin tpmeyer$ brew install ffmpeg
==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.4.el_capitan.bottle.tar.gz
Already downloaded: /Users/tpmeyer/Library/Caches/Homebrew/ffmpeg-3.4.el_capitan.bottle.tar.gz
==> Pouring ffmpeg-3.4.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/ffmpeg/3.4: 248 files, 51.6MB
Thomass-iMac:bin tpmeyer$ brew tap homebrew/science
Thomass-iMac:bin tpmeyer$ brew install --HEAD opencv3 --with-ffmpeg
Error: No head is defined for opencv
Thomass-iMac:bin tpmeyer$ brew install opencv3 --with-ffmpeg
Warning: opencv: this formula has no --with-ffmpeg option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/opencv-3.3.1_1.el_capitan.bottle.1.tar.gz
Already downloaded: /Users/tpmeyer/Library/Caches/Homebrew/opencv-3.3.1_1.el_capitan.bottle.1.tar.gz
==> Pouring opencv-3.3.1_1.el_capitan.bottle.1.tar.gz
🍺 /usr/local/Cellar/opencv/3.3.1_1: 519 files, 97.9MB

Then when I run my image detection code, it works (sort of, except I can't detect keyboard or mouse) and I still get this error:
GVA info: Successfully connected to the Intel plugin, offline Gen75
2017-11-25 07:28:10.897 Python[24977:913156] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.

relikd

relikd commented on Nov 25, 2017

@relikd

I noticed you typed opencv3 instead of just opencv (I think both will install v3 anyway but I'm not sure about that).
If this isn't working you can also try the following:

  1. Save this in a desktop file named myBrewfile.txt:
brew tap homebrew/science
brew "opencv", args: ["c++11", "with-ffmpeg"], link: false
  1. Run brew bundle --file="~/Desktop/myBrewfile.txt"

At least thats what my brew bundle dump command will return (and I have v3 installed). Don't know if it saved all the parameters during install. Also don't know if you have ffmpeg to be installed before or not. (btw. I am currently running El Capitain too)

tpmeyer1

tpmeyer1 commented on Nov 25, 2017

@tpmeyer1
relikd

relikd commented on Nov 25, 2017

@relikd

Try delete the brew tap line if you already tapped into science manually.
If you still get an error search google for the problem

tpmeyer1

tpmeyer1 commented on Nov 25, 2017

@tpmeyer1

When I removed the tap line as instructed, the command worked as intended, and reported that the Brewfile dependency was installed, but It did not solve the event queue error.
I tried it with and without ffmpeg installed beforehand.

Thomass-iMac:~ tpmeyer$ brew bundle --file="~/Desktop/myBrewfile.txt"
Using opencv
Homebrew Bundle complete! 1 Brewfile dependency now installed.

In /usr/local/Cellar, I have
ffmpeg version 3.4
opencv version 3.3.1_1
python3 version 3.6.3

Are those the same versions that are working for you?

relikd

relikd commented on Nov 25, 2017

@relikd

Haven't used OpenCV in months. I have two ffmpeg versions installed v3.2.2 and v3.4.
OpenCV is at v3.2.0. Python3 is v3.6.3.
Beyond my first comment I can't even tell you how I installed it.
Good luck finding a solution :octocat:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @relikd@subokita@mshabunin@alalek@abdullahselek

        Issue actions

          BUG: The current event queue and the main event queue are not the same.... · Issue #7474 · opencv/opencv