I need to update opencv to version 4.5.1 because there is a function that is not implemented in my current version 3.4.2. (I need to use the SIFT_create function, when I google a bit it seems that they removed it from 3.4.2 because of a patent. However, I have also heard from someone that this function has a different name in 3.4.2, so if you know this different name this is fine as well. I googled it but couldn't find anything about it.)
I tried updating opencv in the anaconda navigator but that didn't work. I tried typing
pip install opencv-python==4.0.0.21
(if I replaced 4.0.0.21 by 4.5.1 it couldn't find the version), but when I type
cv2.__version__
afterwards it still says I'm using version 3.4.2. I found this post: How to upgrade OpenCV in Anaconda (windows)? which says I should use
conda install -c conda-forge opencv=4.3.0
I do this, both the exact same command and the command with 4.3.0 replaced by 4.5.1 but in both cases I only get version 4.0.0 (which apparently also doesn't have the SIFT_create function).
Any idea what I could do?
In the meanwhile I found the answer myself (or rather: with the help of non-internet people).
The problem was that while trying to update opencv, I ended up having two versions of opencv at once. I had opencv 4.5.1 and at the same time I had opencv-python 4.0.0.21 installed. When importing opencv, it chose to import opencv-python in stead of just opencv. When I deleted the opencv-python this fixed the problem.
Related
i've been trying to download older versions of cv2 as an easy way to get around not being able to use SIFT.
I've tried the following:
pip install opencv-contrib-python==3.4.2.17
however I get this error:
ERROR: Could not find a version that satisfies the requirement opencv-contrib-python==3.4.2.17 (from versions: 3.4.8.29, 3.4.9.31, 3.4.9.33, 4.1.2.30, 4.2.0.32, 4.2.0.34)
ERROR: No matching distribution found for opencv-contrib-python==3.4.2.17
All the advice I've seen on the site so far tells me to either download these older versions of opencv or to build it myself (which seems like an absolute nightmare)
Anyone have any suggestions on how to install these older versions of cv2?
opencv-contrib-python 3.4.2.17 provides wheels for Pythons up to 3.7. Probably you use Python 3.8.
Use Python 3.7 (or lower). Or compile from sources for 3.8.
I am currently trying to set up the opencv trackers on a Raspberry Pi. However, when I use the MultiTracker_create() function, it gives me an Attribution Error:
multiTracker = cv2.MultiTracker_create()
AttributeError: module 'cv2.cv2' has no attribute 'MultiTracker_create'
The same code works on my computer, but when I try it on the Pi, it experiences the above error. I am currently using Python 3.5 on the Raspi with OpenCV 3.4.4. My computer uses Python 3.7 with OpenCV 3.4.1.
Thank you in advance for your help.
I have made sure that I am using the correct package:
pip3 install opencv_contrib_python
I have also tried to look through the help(cv2) and could not find anything specific about the MultiTracker.
Just stumbled upon this myself. It appears that MultiTracker is no longer part of OpenCV 4.5.1, but you should be able to get it from the legacy package like this:
multiTracker = cv2.legacy.MultiTracker_create()
See https://docs.opencv.org/4.5.1/df/d4a/classcv_1_1legacy_1_1MultiTracker.html
Note that if you subsequently call multiTracker.add(...), you'll need to add the legacy version(s) of the trackers as well.
I've met the same problem and solved it. Maybe you can firstly do pip uninstall opecv-python and pip uninstall opencv-contrib-python, and then do pip install opencv-python==3.4.4.19 and pip install opencv-contrib-python==3.4.4.19. That's my solution, hope it's helpful.
This is an old thread, but I will add my answer, maybe helpful for someone facing same problem.
cv2.MultiTracker_create() is missing from OpenCV documentation also on 4.5.1.
[https://docs.opencv.org/4.5.1/d8/d77/classcv_1_1MultiTracker.html]
OpenCV contrib modules are known to be "unstable" which means that they can break or change. In my case, I had opencv-python and opencv-contrib-python both 4.5.2, but cv2.legacy.MultiTracker_create() was giving error.
Best solution is to uninstall opecv-python and opencv-contrib-python and reinstall version 4.4.0.46.
This will solve the problem.
pip install opencv-python==4.4.0.46
pip install opencv-contrib-python==4.4.0.46
Having an issue with trying to build any opencv version with code::blocks.
I've have built opencv successfully before and have no idea what the issue is.
I've tried following many different tutorials on building opencv using mingw 4.9.2 and CMake. I have also tried using mingw32 and mingw64.
But I continue to receive the errors shown in the image above.
My question is; What is the issue? How can I fix this? And, lastly, what am I doing wrong?
Found that the version of OpenCV I was using had issues with MinGW. Tested a whole bunch of OpenCV versions (3.3, 3.2, 3.1, 2.4.13, 2.4.13.3).
I found that OpenCV version 2.4.9 with the latest version of CMake and MinGW worked.
Thought I'd leave this here to help anyone else having issues with creating OpenCV to work with MinGW/Code::Blocks
I'm trying to use luagraph, a binding to the graphviz library:
http://luagraph.luaforge.net/index.html
To install, I'm using luarocks in Mac OS X. The following command is executed in bash:
luarocks install luagraph
The output is the following:
Installing https://luarocks.org/luagraph-1.0.4-1.src.rock... Using
https://luarocks.org/luagraph-1.0.4-1.src.rock... switching to 'build'
mode
Error: Could not find expected file graphviz/graph.h, or
graphviz/graph.h for GRAPHVIZ -- you may have to install GRAPHVIZ in
your system and/or pass GRAPHVIZ_DIR or GRAPHVIZ_INCDIR to the
luarocks command. Example: luarocks install luagraph
GRAPHVIZ_DIR=/usr/local
I have been installed graphviz using homebrew, but I can't figure out how to pass GRAPHVIZ_DIR or GRAPHVIZ_INCDIR properly.
How can I install luagraph?
I've updated LuaGRAPH a couple of weeks ago. It now supports the newest version of Graphviz based on the cgraph library instead of the old graph library.
There is one drawback: I couldn't get luagraph to run on Windows using mingw because of some runtime library issues (compiler and dll compatibility probably). Please look at the README file for more details.
I personally never produced a rockspec for this module. This was created by someone else based on a fork of my luagraph library.
Installation without Luarocks is simple. Download from
https://github.com/hleuwer/luagraph
and follow the instruction in the documentation and the README file. You need adopt a simple config file which is included by make.
Herbert
Well, luaGRAPH is still the top result when searching for lua and graph. So the question is still standing.
And, unfortunately, the answer is: luagraph is OLD, the last update happened before the ubuntu 14.04 was released. And there seem to be some notable changes in the system itself, the flags the error message show do not seem to work. On top of that, graphviz is now about 20 releases newer than the luarock recommends.
There now is a bare bone alternative lua package: graphviz
It is extremely basic, and documentation in not at all informative, but at least it works.
update: Luagraph may be working again, but not through rocks. See the other answer.
I already have part of a program running in Python 3 but I need OpenCV (or SimpleCV), for a robotic vehicle, but I haven't found any install commands that seem to work, other than for Python 2.7.
If it is compatible could you please include instructions (/links to) for installation of the module?
I am using Ubuntu 14.
Maybe a little late to answer, but it's actually supported on OpenCV version 3 (in alpha state nowadays). I have successfully managed to install it, on MacOS, but I guess it would be similar on Ubuntu.
Now you have separated options for python2 and python3 when using Cmake. So you'll have to set those to make it work. That's all I needed to set:
BUILD_opencv_python3
PYTHON3_LIBRARY
PYTHON3_INCLUDE_DIR
PYTHON3_INCLUDE_DIR2
PYTHON3_NUMPY_INCLUDE_DIRS
...
Here you can find more detailed description: Link
Luigolas is correct that OpenCV 3.0 supports Python 3.x bindings. It was in release candidate status since April and the production version was released on 4 June 2015. Unfortunately for some reason the downloadable installation program on the OpenCV site does not contain a Python 3.x-compatible cv2.pyd file.
OP asked about Ubuntu but for those requiring a Windows installer, use Christoph Gohlke's site, which maintains Windows binaries for many Python packages, including OpenCV 3.0 with Python 3.x bindings. Visit:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.