Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Brew downgrade formula to previous version (opencv3/3.0.0) on mac el capitan

I am on mac and used brew to install opencv3. I was having opencv3/3.0.0 . Today, I updated it and got version 3.1.0_1.

However, this update is breaking everything and when I try to use VideoCapture to read frames and use waitKey function it breaks by causing following:

2016-02-26 23:25:16.846 tracking[99869:1026824] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CaptureDelegate doFireTimer:]: unrecognized selector sent to instance 0x7fab5a601240'

So, now I am trying to switch back to the following version, but I am not sure how. I used following:

brew search opencv

However, this wont give me versions like opencv3/3.0.0

In the Cellar, I have only

Versions available: 3.1.0, 3.1.0_1

So, I cannot use

brew switch "version"

Could anyone please suggest me a way of switching back to the previous version?

like image 956
fiz Avatar asked Sep 26 '22 06:09

fiz


1 Answers

Here is the recipe for 3.0.0

https://github.com/Homebrew/homebrew-science/blob/f4369af77876e0597e1f23bf2dd0f1ee17efd680/opencv3.rb

Homebrew appears to store it's local recipes here:

/usr/local/Library/Taps/homebrew/homebrew-science/opencv3.rb

So you might try:
- brew uninstall opencv3
- replace the local file with that version.
- brew install opencv3
(this is untested, i would definitely make a backup first)

A better solution is to compile the latest openCV from source - a patch has been added to fix the issue. The thread relating to this bug has some good pointers as to the procedure. Compiling openCV from source is pretty handy, both if you require particular features, and because irritating bugs like this crop up fairly frequently. Package managers (and opencv.org's own binaries) are rarely up to date with the patches.

update
better methods to move backwards or forwards..

moving back to 3.0
the note from @bfontaine...

brew install https://github.com/Homebrew/homebrew-science/blob/f4369af77876e0597e1f23bf2dd0f1‌​ee17efd680/opencv3.rb

moving on to 3.1.fixed
latest advice from mateuszmikusz and LukasKalinski on that thread

brew remove opencv3  

(effectively cleaned everything and Xcode immediately noticed it)

brew cleanup
brew install --HEAD opencv3

Keep in mind though that this is installing the newest code base which is not stable and may introduce other bugs.

like image 172
foundry Avatar answered Oct 12 '22 11:10

foundry