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.
Related
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?
I'm working with Openslide's python bindings. I am using Tif images, which are supported by Openslide. It seems I am able to use the methods read_region and get_thumbnail with a smaller, binary masked Tif of about 100 mb's.
However, with a larger, RGBa Tif of about 1.5 Gb, I get the following error:
openslide.lowlevel.OpenSlideError: Wrong JPEG library version: library
is 90, caller expects 80
I have libjpeg8d installed, and everything seems fine with a smaller Tif. Any suggestions on how fix this issue?
I would guess your smaller TIFF is not JPEG-compressed, but your larger one is.
When libtiff starts the jpeg decoder, it checks that the version number in the libjpeg library binary matches the version number in the libjpeg headers that it was compiled against, and if they do not match, it prints the warning you are seeing.
The error means that you have installed a new jpeg library, but not recompiled libtiff or perhaps openslide.
You don't say what platform you are using, but on linux these issues should all be handled for you by your package manager, as long as you stick to the supported versions. If you've built any parts of the system yourself, you'll need to recheck how each part was configured and installed, and how your environment has been set up.
Hi can anyone help. I am getting glitching on pygame sprite. The sprites are 50x50 pixels 72 res created in Photoshop. I am using:
tile.image = pygame.image.load(tile.name) to load adding them to a pygroup tileGroup.add(tile) then just doing a regular tileGroup.draw(screen)
I have tried the code on a Windows PC and it works fine. I can only assume it is a MAC thing. Can anyone shed any light?
I had the same problem and I fixed it by downgrading from SDL v1.2.15 to 1.2.10. SDL Library has this nasty bug exclusively on El Capitan and on versions higher than 1.2.10.
To downgrade via Homebrew, you should:
Go to "/usr/local/Library/Formula", find "sdl_image.rb" and rename it to something in case to backup it.
In Terminal, use "brew create https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz". It should create new "sdl_image.rb" in the same location.
Open the new "sdl_image.rb" and the old one; Copy the lines that starts with "depends_on" and whole "install" function from the old image file and then replace "install" function in the new file with these lines.
In Terminal, use "brew install sdl_image".
This also sometimes happens with the Tkinter module, and mostly on mac (when you draw things on the screen it lgitches a lot.)
I believe it is a mac problem, so you could try the following:
You could use a different image,
you could .convert() the image
you could .convert_alpha() the image
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