installing opencv
Hy,
I need OpenCV for a project I'm working on, however so far I've not been able to successfully build it. I've been trying numorous build guides and haven't found any solution yet. The make process always fails with the errors listed in the code section below.
I found several posts online of people having the same issue. However I've tried all these and none of them seemed to work for me.
I originally was trying to build an older version of opencv 2.4.9 because some of the code I'm using is using the older opencv. However, even with the new version 3.0 it is not working for me. Does anyone have any suggestion what I might try?
I will also include the result of the cmake configuration.
Thanks.
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:317:36: error: ‘avcodec_free_frame’ was not declared in this scope
avcodec_free_frame(&picture);
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*)’:
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:632:43: error: ‘avcodec_alloc_frame’ was not declared in this scope
picture = avcodec_alloc_frame();
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:635:41: error: ‘PIX_FMT_BGR24’ was not declared in this scope
avpicture_get_size( PIX_FMT_BGR24,
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)’:
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:738:67: error: ‘PIX_FMT_RGB24’ was not declared in this scope
avpicture_fill((AVPicture*)&rgb_picture, rgb_picture.data[0], PIX_FMT_RGB24,
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:756:17: error: ‘PIX_FMT_BGR24’ was not declared in this scope
PIX_FMT_BGR24,
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘AVFrame* icv_alloc_picture_FFMPEG(int, int, int, bool)’:
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1110:35: error: ‘avcodec_alloc_frame’ was not declared in this scope
picture = avcodec_alloc_frame();
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1113:33: error: ‘PixelFormat’ was not declared in this scope
size = avpicture_get_size( (PixelFormat) pix_fmt, width, height);
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1122:38: error: expected ‘)’ before ‘pix_fmt’
(PixelFormat) pix_fmt, width, height);
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: At global scope:
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1104:47: warning: unused parameter ‘pix_fmt’ [-Wunused-parameter]
static AVFrame * icv_alloc_picture_FFMPEG(int pix_fmt, int width, int height, bool alloc)
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, AVCodecID, int, int, int, double, int)’:
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1230:19: error: ‘PixelFormat’ was not declared in this scope
c->pix_fmt = (PixelFormat) pixel_format;
^
/home/matthias/Programs/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp: At global scope:
/home/matthias/Programs/opencv-3.0.0 ...
try do disable ffmpeg in cmake
Hy, I allready tried that, and it makes the build succeed. However, I need to be able to read video files in formats such as x264 and as far as I tested it, this was no longer possible.
In your cmake log you have got an error Looking for ffmpeg/avformat.h - not found. Can you set good path to ffmpeg include?