I can't install opencv-contrib-python on PyCharm using the Setting options provided by PyCharm. I get these error everytime I tried first not using the --user option, such as in image 1:
Then I tried using the --user option, and I got what is showed in image 2
My knowledge of Python is very weak and I don't need to get it better right now. I have a script I need to run for a very close presentation (in the script there are many section with many examples of how to use SIFT, image homography, and other stuff used in image processing and artificial vision. I can't run the SIFT part, this is why I need opencv-contrib-python). I'm using opencv 3.4.3.18 and I need to make the script working for that distribution!
I haven't found anything of useful since now and I'm in quite a hurry and still without a solution.
Thank you for the help!
Related
I am trying to install OpenCV following this link https://docs.opencv.org/master/d5/de5/tutorial_py_setup_in_windows.html
opencv-4.5.1 is the version I am building from source. I have no errors in my entire process( up to Step 16)
Step 17 which INSTALL also has no errors, but Step 18 'import cv2 as cv' will not import this module.
I have python 3.9.1. I followed all the steps with CMAKE and was able to generate with no errors.
Is there something that I am missing here?
I would recommend to use another IDE like Pycharm to create your projects. It is extremely easy to setup an OpenCV work environment :).
IDLE is great for smaller projects but I`ve seen a lot of people having issues with it.
I have found some other threads but they didn't help my problem.
The lines that I'm confused about are:
print("videopath",os.path.isfile(video_path),video_path)
self.cap = cv2.VideoCapture(video_path)
print("is open?",self.cap.isOpened())
It says my file exists (the first line returns true, and prints the direct path to my .mp4), and when I put cv2.VideoCapture in a try/catch, it succeeded without an issue. However it says the video is not open and I can't pull any frames from it. I'm on Ubuntu 16.04, using OpenCV 3.3 and Python 3.5.
Any suggestions would be much appreciated, thank you.
In the end it was because I had the wheel version of OpenCV installed on top of my manual installation. DON'T use pip install opencv-python as it is not official and errors like this will occur. This was an incredible guide that made it very easy: https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
To be clear though, I had gone through this whole process once, and then tried pip just because, and it broke it, so once you install it manually, don't touch the wheel packages!
I have pip installed opencv-python on my Ubuntu guest OS hosted in a virtual box. Both my python and Ubuntu are 64-bit. But when I import cv2 I couldn't find all the functions to manipulate images. The following is an image of the ini file I get when I do ctrl+B.
I uninstalled the opencv and followed many tutorials to install opencv using apt-get including from the official opencv website and none of them worked for me. Can someone give me a hint what I can do to get opencv to work?
Following this tutorial, I was able to finally install opencv properly. I am posting my answer to help someone in a similar situation. Ubuntu version is the most important thing you have to check before you follow any of the tutorials. Just like my case, if you happen to follow one of the old tutorials but your Ubuntu version is 16, you need to remove the opencv altogether then follow the tutorial.
After the fix, my ini looks like this. It consists all the functions to manipulate image. The screenshot shows the partial shot in my ide.
I am trying to set up Bachbot (https://github.com/feynmanliang/bachbot) on my Windows 10 system in Python 3.5.1, Anaconda 4.0.0. Though doing several attempts, I keep failing at getting this to work. I downloaded the source code from github (didn't use Docker) and got to work.
First thing that's good to know is that I changed all print statements and added parantheses. Furthermore I changed every import of cPickle to
import _pickle as cPickle
since I'm using a newer version of Python. By doing this, I cleared all compile errors, but now I'm stuck at the first few steps of getting the program to work. When calling
bachbot chorales prepare_poly
I get an error
Usage: bachbot-script.py [OPTIONS] COMMAND [ARGS]
Error: no such command "chorales"
I figured the chorales script is part of the music21-module, which I installed on my computer using pip.
As far as I know I followed the installation steps more or less correctly (see github Getting Started and Workflow):
run activate script
run pip install --editable .
2.5 (installed the missing module music21)
run bachbot chorales prepare_poly
I suspect it has something to do with the entry point but I can't put a finger on what's wrong. I tried several re-installs but that does not seem to do the trick.
I would be grateful if someone could help me with this. Thanks in advance!
My apologies, I was rushing to get the thesis in on time so the documentation is not the best!
The commands for building the polyphonic dataset and training the model are:
bachbot datasets prepare
bachbot datasets concatenate_corpus scratch/BWV-*.utf
bachbot make_h5
bachbot train
To use the model trained for $ITER iterations to generate samples with a sampling temperature of $TMP:
bachbot sample ~/bachbot/scratch/checkpoints/*/checkpoint_<ITER>.t7 -t <TEMP>
bachbot decode sampled_stream ~/bachbot/scratch/sampled_$TMP.utf
The first and last section of a recent presentation I made summarizes this workflow.
By the way, I would recommend using the Docker image described in the presentation I linked. While the CLI is in Python, the actual LSTM has additional dependencies (e.g. Lua, Torch, CUDA if you plan on using a GPU).
I am trying to write a script that will extract a single frame from a user uploaded video clip in order to create a thumbnail. It sounds like either OpenCV or ffmpeg will do what I need, but I am having trouble installing them.
I tried installing OpenCV using apt-get install libopencv-dev, and it looks like everything worked, but when running import cv2 in Python, it says there is no such module. Also tried installing using these instructions, but when I run the import, it hangs for a second or two and then says Failed to initialize libdc1394.
I then tried to install ffmpeg with pyffmpeg, but the most recent version of pyffmpeg I could find was released 3 years ago and built for Python2.6 on Ubuntu 10.10, while I am using 2.7 on Ubuntu 12.04.
Does anyone have experience installing either of these, or would recommend something else for this purpose?
If you are trying to install ffmpeg, you can do this more easily if you have homebrew and then use brew to install it. It's a lot more complicated otherwise.
If you just want to be able to complete this task, and it doesn't have to be the tool you're listing, you could try ffmpeg-python. After you have it installed, you can use the get_video_thumbnail example to get a single image. You could also probably tweak the read_frame_as_jpeg example to get a single image from a frame if you want.