M
M
mr_blaze2018-02-18 14:30:49
linux
mr_blaze, 2018-02-18 14:30:49

How to properly install OpenCV on Linux(K)Ubuntu 16.04?

Hello! I'm sitting for the second week trying to start playing with OpenCV in c ++. The problem is this: I collected OpenCV from several guides. There were no errors during assembly. I also installed it for the snake and Node.Js, everything was great.
But when trying to run the simplest program

#include "opencv/opencv/cv.hpp"
#include "opencv/opencv/highgui.h"

int main()
{
    cvNamedWindow("Name", CV_WINDOW_AUTOSIZE);
    cvWaitKey();
    return 0;
}

An error is thrown
/home/mr_blaze/.local/share/umake/ide/clion/bin/cmake/bin/cmake --build /home/mr_blaze/Документы/apps/cppVision --target cppVision -- -j 2
Scanning dependencies of target cppVision
[ 50%] Building CXX object CMakeFiles/cppVision.dir/main.cpp.o
In file included from /usr/local/include/opencv/opencv/cv.hpp:50:0,
                 from /home/mr_blaze/Документы/apps/cppVision/main.cpp:1:
/usr/local/include/opencv/opencv/cv.h:66:38: fatal error: opencv2/video/tracking_c.h: Нет такого файла или каталога
compilation terminated.
CMakeFiles/cppVision.dir/build.make:62: ошибка выполнения рецепта для цели «CMakeFiles/cppVision.dir/main.cpp.o»
make[3]: *** [CMakeFiles/cppVision.dir/main.cpp.o] Ошибка 1
CMakeFiles/Makefile2:67: ошибка выполнения рецепта для цели «CMakeFiles/cppVision.dir/all»
make[2]: *** [CMakeFiles/cppVision.dir/all] Ошибка 2
CMakeFiles/Makefile2:79: ошибка выполнения рецепта для цели «CMakeFiles/cppVision.dir/rule»
make[1]: *** [CMakeFiles/cppVision.dir/rule] Ошибка 2
Makefile:118: ошибка выполнения рецепта для цели «cppVision»
make: *** [cppVision] Ошибка 2

I got into /usr/local/include/opencv/opencv/cv.hpp:50:0 and saw this:
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                           License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of the copyright holders may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#ifndef OPENCV_OLD_CV_HPP
#define OPENCV_OLD_CV_HPP

//#if defined(__GNUC__)
//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
//#endif

#include "cv.h"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/video.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/objdetect.hpp"

#endif

Despite the fact that
[email protected]:/usr/local/include/opencv$ ls
CMakeLists.txt  opencv  opencv2
[email protected]:/usr/local/include/opencv$ ls opencv
cvaux.h  cvaux.hpp  cv.h  cv.hpp  cvwimage.h  cxcore.h  cxcore.hpp  cxeigen.hpp  cxmisc.h  highgui.h  ml.h
[email protected]:/usr/local/include/opencv$ ls opencv2
opencv.hpp
[email protected]:/usr/local/include/opencv$

What should I do?
And how did it happen?
Are there OpenCV analogues for pros?
Thank you in advance for your help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mr_blaze, 2018-02-24
@mr_blaze

Thanks to all! The problem was solved: 'like this and this instead of#include <opencv2/opencv.hpp>

#include "opencv/opencv/cv.hpp"
#include "opencv/opencv/highgui.h"
.

C
CityCat4, 2018-02-18
@CityCat4

cmake cannot find the opencv2/video/tracking_c.h file to include in the project.
Why set it manually? There are no packages for bubuntu? I don't believe in life! Manually putting something on a packaged distribution is about the same as walking around the outskirts of the private sector in the evening and yelling that you are cool and you are not afraid of anyone :) That is, it may well be that you are really cool - in relation to manual assembly this means that you know exactly where opencv put all the auxiliary build files after the build and how to tell autotools and cmake where to find them :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question