简体   繁体   English

opencv 3.0在Ubuntu 15.10上不起作用

[英]opencv 3.0 not working on ubuntu 15.10

I was using opencv 3.0 on eclipse in ubuntu 15.04 and it was working fine, i updated to ubuntu 15.10 and now even a simple code is giving me errors. 我在ubuntu 15.04中的eclipse上使用了opencv 3.0,它运行良好,我更新到了ubuntu 15.10,现在即使是一个简单的代码也给我带来错误。 I think some files or libraries got misplaced or deleted, I have tried dozens of things but none seems to be working. 我认为某些文件或库被放错了位置或删除了,我尝试了数十种方法,但似乎都无法正常工作。 Here's the eclipse output 这是蚀输出

Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "DisplayImage"  ./src/DisplayImage.o   -lopencv_core -lopencv_hal -lopencv_viz -lopencv_flann -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_features2d -lopencv_videostab -lopencv_ml -lopencv_calib3d -lopencv_objdetect -lopencv_superres -lopencv_stitching -lopencv_photo -lopencv_video -lopencv_videoio
/usr/bin/ld: warning: libavcodec.so.56, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
makefile:45: recipe for target 'DisplayImage' failed
/usr/bin/ld: warning: libavformat.so.56, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavutil.so.54, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libswscale.so.3, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libIlmImf.so.6, needed by /usr/local/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libHalf.so.6, needed by /usr/local/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_codec_get_id@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_alloc_frame@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_find_encoder@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_close@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_guess_codec@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_write_header@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_sub_q@LIBAVUTIL_54'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::hasChromaticities(Imf::Header const&)'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Chromaticities::Chromaticities(Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_opt_set@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_seek_frame@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avpicture_get_size@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_codec_get_tag@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::globalThreadCount()'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_guess_format@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_alloc_context@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::chromaticities(Imf::Header const&)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_write_trailer@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_open2@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::OutputFile::setFrameBuffer(Imf::FrameBuffer const&)'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::InputFile::header() const'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avio_open@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_decode_video2@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::InputFile::InputFile(char const*, int)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_register_all@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::OutputFile::~OutputFile()'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_getCachedContext@LIBSWSCALE_3'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_new_stream@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_rescale_q@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_init_packet@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::InputFile::setFrameBuffer(Imf::FrameBuffer const&)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_find_decoder@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_scale@LIBSWSCALE_3'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_freeContext@LIBSWSCALE_3'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Header::channels() const'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Header::channels()'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_malloc@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_freep@LIBAVUTIL_54'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Header::~Header()'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_free_context@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_getContext@LIBSWSCALE_3'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::OutputFile::OutputFile(char const*, Imf::Header const&, int)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_free@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_free_frame@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Header::Header(int, int, float, Imath::Vec2<float> const&, float, Imf::LineOrder, Imf::Compression)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_get_context_defaults3@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::OutputFile::writePixels(int)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_free_packet@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_write_frame@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avpicture_fill@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_dict_free@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_open_input@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_network_init@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `half::_eLut'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_encode_video2@LIBAVCODEC_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Header::dataWindow() const'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_log_set_level@LIBAVUTIL_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_lockmgr_register@LIBAVCODEC_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_read_frame@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::ChannelList::findChannel(char const*) const'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_close_input@LIBAVFORMAT_56'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::InputFile::readPixels(int, int)'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `half::convert(int)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_dict_set@LIBAVUTIL_54'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avio_close@LIBAVFORMAT_56'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_get_riff_video_tags@LIBAVFORMAT_56'
collect2: error: ld returned 1 exit status

Any help will be appreciated 任何帮助将不胜感激

warning: libIlmImf.so.6, needed by .../libopencv_imgcodecs.so

Clearly libopencv_imgcodecs.so depends on libIlmImf.so.6 , yet you are not using the latter on your link line. 显然, libopencv_imgcodecs.so依赖于libIlmImf.so.6 ,但您并未在链接行上使用后者。

You should append -lIlmImf to your link, and that will likely solve all the Imf::... problems. 您应该在链接后附加-lIlmImf ,这样很可能会解决所有Imf::...问题。 Repeat with other libraries that the linker told you to add. 重复链接器要求您添加的其他库。

Do you have libav installed on ubuntu? 您在ubuntu上安装了libav吗? This library is used by OpenCV to read the different video formats. OpenCV使用此库读取不同的视频格式。 You can probably find the .so files in /usr/lib or /usr/local/lib and then add it to you G++ call. 您可能可以在/ usr / lib或/ usr / local / lib中找到.so文件,然后将其添加到G ++调用中。 I'm not familiar with Eclipse, but you should be able to follow this to add the dependency. 我对Eclipse不熟悉,但是您应该可以遵循来添加依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM