I have installed OpenCV 3.1.0 from the sourfage site. It is pre-built. I've followed this site's tutorial. Tried to read a mp4 video at first, but got negative result. After did some searching, I've included a path to the opencv_ffmpeg310.dll (at the same time, also to the opencv_ffmpeg310_64.dll) which is in the directory of C:\opencv\build\bin\. But I can't play some avi videos (not all). I have installed Xvid but still got no any positive results. Whenever I've tried to play this avi video, I will get message that said python.exe has stopped working.
Any ideas how to solve this?
Related
I am trying to convert midi files to .wav files using midi2audio. The code is taken from the documentation and doesn't throw any error. However, there doesn't seem to be any new wav file. Here are the code lines:
fs = FluidSynth()
fs.midi_to_audio('input.mid', 'output.wav')
I haven't found any useful information about my problem, neither in the documentation (I have fluidsynth installed, so that shouldn't be the problem) nor in other questions.
notes: I'm using python 3.6
Any help will be appreciated
do you have some fonts loaded ? run the program in debug mode to see the path required and put font files.
I'm using retrain.py to retrain an object detector on photos of my hand (to detect how many fingers I'm holding). On the Tensorflow site, I followed the tutorial where I retrained it on their images of flowers. So I wrote python retrain.py --image_dir ~/flower_photos and it worked. I had my hand_photos directory which contained sub-directories of me holding various fingers up. However I received this error:
tensorflow.python.framework.errors_impl.NotFoundError: /Users/spencerkraisler/hand_photos/untitled folder; No such file or directory
I don't understand why it's looking for some untitled folder in my hand_photosdirectory, nor why it works find on flower_photos.
I am using the current tensor flow and python 3.6. I am in an anaconda environment however this works just fine with flower_photos.
Furthermore, flower_photos just contains sub-directories of photos of various flowers, all .jpg. My photos are also in .jpg format.
Well problem solved. I actually had an empty directory named "untitled folder" in my training data. I must've created it by accident. Case closed.
I know this question was asked hundred of times, nevertheless I got problems.
I'm working on a new windows (2010 server) systen, installed Python 2.7.9 and OpenCV 2.4.10. I copied opencv_ffmpeg.dll to Python27\opencv_ffmpeg2410.dll. I also installed K-Lite video codecs. If I try to save a video with VideoWriter (MJPG), I get always a file with size 5682 bytes which is not playable. On my old system the same python code works, but over the years I installed several versions of drivers and ffmpeg and whatever. So is there a systematic way to get VideoWriter working if you are on a freshly installed system?
Ok, it was my own fault. All the above steps were ok. I made the error to define cv2.VideoWriter(fname,fourcc,2,(w,h),1) with (w,h) different to the actual frame size (I thought it rescales automaticly). Unfortunately there is no appropriate error message.
So my problem is solved.
i'm trying to utilize PIL to open a jpeg image and assign it to a Tkinter's label.
However whenever i try to open the image i get the same problem as this guy
I tried all the suggestions he got and also the ones i found here but it doesn't seem to fix, by installing PIL or Pillow(i tried that too) during the setup i get :
*** TKINTER support not available
*** JPEG support not available
And whenever i run my code i get an IOError: decoder jpeg not available
I'm using python 2.7.
Can someone provide a good method to make PIL or Pillow work with jpeg support? I've been googling extensively for two days, but all the possible fixes that i found don't seem to work for me
Installing libjpeg-dev should do the trick, as proposed by the link you provided. But if it doesn't help (I ran into that as well) you can consider upgrading to Pillow 3, it looks like you are running Pillow 2. This also helped me getting rid of the errors, don't know why exactly..
I"m experiencing the same problem a lot of other people are experiencing with openCV, in that when I use the following code, openCV fails to write a video file. I am using openCV 2.4.10 and python 2.7
out = cv2.VideoWriter('C:\motion\output.avi',cv2.cv.CV_FOURCC('X','V','I','D'), 20, (640,480),True)
a viable work around is to replace the second argument with -1, which gives a popup window with coded choices when the program is run. When one of these is selected, the video is created.
The problem is, I am adding it to a motion detection software which writes a 15 second timestamped file every time it detects motion, and obviously selecting a codec manually does not work with this scheme.
Is there a way to direct openCV to select one of these codecs using VideoWriter, or some other method?
THINGS I HAVE TRIED ALREADY:
copying opencv_ffmpeg.dll to python folder and selecting FMP4 codec from FOURCC
While I did not find an alternative way to select the codecs available, I did find the answer to the underlying problem of openCV not finding it's own codecs (which is good because the windows codecs were producing files ~50x larger than those produced by the fmp4 codec).
Access the codecs, copy the files from the opencv\sources\3rdparty\ffmpeg folder to your python27 folder, then change the names from opencv_ffmpeg.dll to opencv_ffmpegXYZ.dll where XYZ = your version of openCV. For example I have openCV 2.4.10 so I changed it to opencv_ffmpg2410.dll. More examples can be found on this question.
OpenCV 2.4 VideoCapture not working on Windows