C++, making OpenCV 3.0.0 available with HDR API - c++

I am using OpenCV 2.4.6 on my Mac using XCode IDE. I am trying to create HDR images and I found this tutorial.
When I build it, it doesn't recognize, for example, CalibrateDebevec identifier. The problem is that in the header files of photo.hpp, it is not declared. In the tutorial is written that the base is OpenCV 3.0.0.
How can I make OpenCV 3.0.0 available?
I already tried to download these files from http://193.87.95.148/openwrt/mx23/trunk/dl/opencvtrunk-2.5.0/ and pasted the headers files into my include folder, but when I solve one problem, 10 more problems appear.

You can build OpenCV 3.0.0 from the current DevZone root master repository at http://code.opencv.org/projects/opencv/repository. Clone that repository and use cmake + options, make, and make install, just as you would when building any version of OpenCV. Good luck!

Related

VCPKG Pcl: Cannot open include file: 'pcl/io/vtk_lib_io.h': No such file or directory

I am trying to compile a project using Point Cloud Library (PCL) on Windows 10 using Visual Studio 2019.
I installed the PCL library via vcpkg (latest version 2020.07) both the pcl and pcl[vtk] version.
Vcpkg is connected to my program through its vcpkg integrate install function.
I am using the dynamic build in release mode.
When I compile my project I get the error
Error C1083 Cannot open include file: 'pcl/io/vtk_lib_io.h': No such file or directory
And indeed when searching through the vcpkg folder on my hard drive this file seems to be missing.
All other PCL headers and functions seem to be installed correctly.
Does somebody know how to correct</further debug this problem or install PCL in a way that includes all necessary files.
Vcpkg lists PCL as installed:
pcl:x64-windows 1.11.0#3
pcl:x64-windows-static 1.11.0#3
pcl[vtk]:x64-windows-static
vtk:x64-windows-static 9.0.1#2
The visualization module in PCL is currently disabled within vcpkg since PCL currently does not support VTK 9.
You either have to use overlay ports to install VTK 8.2 or update PCL to use the PR adding support for VTK 9

OpenCV not found when I have it installed?

I am trying to compile a cpp file from the dlib library using cmake.
When I use the command cmake ..
It gives me this error OpenCV not found, so we won't build the webcam_face_pose_ex example.
I have OpenCV installed and to be sure I just reinstalled it using brew install opencv
Would like some help on what else I could do?
Download the opencv sources and follow the instructions to build and install the project using make. This will allow make to install opencv to where it can find it later.
When complete, re-compile the dlib project using cmake.

build opencv with extra modules error ocv_download

I try to build openCV with Extramodules. If I try to configure the projectfiles (vc14 x32 on windows 10) with cmake there's the error:
CMake Error at opencv_contrib-master/modules/xfeatures2d/cmake/download_vgg.cmake:13 (ocv_download):
Unknown CMake command "ocv_download".
Did anyone ever have this problem and knows how to solve it?
The simple answer is you are using incompatible versions of opencv and opencv_contrib, you might be installing current version of opencv_contrib on maybe opencv2.4.xx
Well, the download link for opencv contrib in CMake script https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d now is 400: Invalid request.
From the commit https://github.com/opencv/opencv_contrib/commit/593e78c5d084aa0a29eb1e0459fc7f7a4dd52ea8 you can try to ignore the added line in CMakeLists include(cmake/download_vgg.cmake) and rebuild.
The below is basing on my experience, I'm not sure it will works for OpenCV 3.0.
Maybe you can try to clone opencv contrib from git, then copy it to somewhere (for example modules directory in opencv source code). Then use CMAKE to set OPENCV_EXTRA_MODULES_PATH. If the hash is correct then it won't download and use the offline package.
I have try and build success OpenCV 2.x with IPP.
Hope it help.
Just follow instructions here.
Make sure you have active internet connection while building Opencv with contrib module.
When you hit config button on cmake(gui), it downloads other files like
vgg_generated_...
boostdesc_binboost_...
boostdesc_lbgm.i
P.S: i compiled Opencv 3.1 with contrib. Cmake downloaded required files & configure was Done.

OpenCV C++ does not load ANY video on Ubuntu 16.04 under VideoCapture

I installed OpenCV 2.4.13 after installing the required dependencies and I'm running it with Qt Creator 5.7 for programming in C++. Following some tutorials I managed to load still images, process them and so on. But when I try to use the cv::VideoCapture, for example:
cv::VideoCapture cap;
cap.open("<File location/file name>");
or:
cv::VideoCapture("<File location/file name");
cap.isOpened() always return false. Even if I try to ignore this and go further with Mat, read, imshow and so on, the program crashes. I've already tried everything about loading the file: giving a std::string as argument, giving a *char, putting the video file on easier locations, in the project directory and nothing works. I tried with two different .mp4, with a .mov and with the cube4.avi file given in the "samples" folder (from openCV examples). All these files are perfectly played by my VLC. I've already tried in Qt with a QtWidgets project and with a plainCpp project. It never works. After searching about it, I've seen that this bug is very recurrent, but I've just found solutions for Windows, regarding on adding a .dll file to the project. But what should I do on Ubuntu, since Linux uses no dlls?
I figured out how to solve this and I'm here to share with everyone who encounter similar problems. First of all, my FFmpeg installation was for any unknown reason ignored on the OpenCV compilation. Since FFmpeg is needed to read and write videos, OpenCV wasn't able to do these jobs and displayed no error or warning messages about that. Anyway I decided to try everything again from the beginning. Keep in mind: if you just reinstall FFmpeg, it's not going to solve your problems; after that you have to do cmake, compile and install OpenCV again. I downloaded the most recent version of FFmpeg from the repository, compiled and installed it again. I tried to compile OpenCV again, but it was always stuck at about 15% when processing a FFmpeg (Libav) .h file with the message:
<file_name.h> can not be used when making a shared object; recompile with -fPIC
So I searched for it and with some effort I found out that it was necessary to compile the FFmpeg with the following configure line before doing the make:
.\configure --enable-pic --enable-shared
Some ffmpeg installation tutorials include even more commands after "configure". Then I compiled and reinstalled FFmpeg and compiled and reinstalled OpenCV. After that, I was able to load videos (the cap.isOpened() was no longer false), but nonetheless I was getting the following error for any video and they weren't being read:
Assertion desc failed at libswscale/swscale_internal.h:674
The way I found to solve this was downloading the newest stable FFmpeg version instead of the newest on, compiling it again, compiling OpenCV again and then it was successful! Now I can both load and write video files (I haven't tested it with multiple codecs yet). I wonder why they don't launch pre-compiled versions of OpenCV with everything so that we don't need to deal with all these stuffs...
Summarizing everything:
Download the last stable release of FFmpeg. If it doesn't work, try an older one. (I'm using the 2.8.6, the last stable right now).
Unpack it, open the terminal from the ffmpeg folder, compile and install it typing:
.\configure --enable-pic --enable-shared
make
sudo make install
Download OpenCV (if you haven't done it yet), unpack and install it following the official linux installation tutorial:
http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
I solve the problem by install "opencv3.2.0-dev" instead "opencv3.2.0";
pip install opencv-python is not enough to install OPENCV.

installing OpenCV with Code::Blocks / CMake

I am fairly new to C++ in general (though I am getting used to the basics), but now I am trying to add OpenCV to my projects to access some of the basic image processing features. I have read the documentation so I have a pretty good idea where to start, but I am really stuck with the installation.
I am working with Code::Blocks 16.01, and I have downloaded both CMake 3.4.3 and OpenCV 3.0.0 and 3.1.0. OpenCV has been extracted to "c:\opencv", and I have attempted to finish the build with CMake (using the directions from the OpenCV documentation as well as from several older posts from this site). I am selecting "Codeblocks - MinGW Makefiles" from the list of generators, though I have selected from all of the "Codeblocks" options at one point or another.
Anyway, whenever I try to configure or generate I receive the following error: "The program can't start because libintl-8.dll is missing from your computer." So yeah, I am stuck.
It is worth noting that many, if not all, of the posts I have found refer to a directory named "\x86\mingw\lib", however I cannot find "mingw" in any of the OpenCV downloads (and the most recent is missing "x86" as well) - so none of these posts have been particularly useful to me (for example):
How to compile a program using OpenCV 2.4.3 with Code::Blocks?
Put the path to all the MinGW dll files in your pc's path variable. Check your Code::Blocks installation directory ( C:\Program Files (x86)\CodeBlocks\MinGW\bin ) if it does not exist, you'd have to download and install MinGW separately. You'd have to add the MinGW .dll files to the path environment.