Build Exiv2 and OpenCV libraries in a single Visual Studio C++ 2017 project

Added by H. Górriz 8 months ago

Hi everyone!

I'm a complete newbie on the subject of programming in general. I guess that's the main reason I'm having such a hard time installing the Exiv2 library. This is my issue:
I managed to install the OpenCV library with all the extra modules thanks to certain Internet tutorials. I used the cmake-gui to assemble the entire library and added it to a Visual Studio 2017 C++ project. I need to use and read certain metadata from some .TIFF images so I tried to do something similar with Exiv2, but I didn't get it. I have tried to follow the tutorials that are explained in the Exiv2 documentation, but due to my lack of knowledge, I see them so summarized that I cannot apply them.
I need basically (and I hope someone here can help me with it) an accessible explanation for me to install both OpenCV and Exiv2 in a Visual Studio C++ 2017 project.

Thank you very much for everything in advance,
Hector.

PS: If any clarification on the subject is needed I am willing to explain the problems I have had in detail.


Replies (4)

RE: Build Exiv2 and OpenCV libraries in a single Visual Studio C++ 2017 project - Added by Robin Mills 8 months ago

Hector

I'm surprised you haven't been able to build Exiv2 using the documentation provided. Another approach is to download Exiv2 v0.26 which is already built. However Exiv2 v0.26 and Visual Studio 2017 were both released in April 2017. I did check that Exiv2 does successfully build with 2017, however I didn't publish Exiv2 using Visual Studio 2017.

I don't know anything about OpenCV and don't want to spend time on building it. The normal way to use libraries in a Visual Studio project is link the library from your application. So, you should build Exiv2 using the materials provided. And build OpenCV. In your application, the include files and libraries should both be visible and linked into to your application. I think VS2017 enables to you to make both OpenCV and Exiv2 as "subprojects" of your application, however before getting involved in that, you should build Exiv2 "out of the box".

I will be happy to speak with you on Skype ('clanmills'). We can screen share and get you moving. I am in England and available in the afternoon and evening for discussion (UTC 12:00 - 22:00).

Robin

RE: Build Exiv2 and OpenCV libraries in a single Visual Studio C++ 2017 project - Added by H. Górriz 8 months ago

First of all, thank you very much for your quick response. I appreciate it a lot.

I suppose your very convincing response encouraged me to try again. This time I had some luck and I realised a detail I wasn't considering before. I will summarise the entire procedure that I followed as detailed as possible in case it helps someone who is or will be in my situation:

1º- I downloaded from the website in the "Builds" section the file "exiv2-0.26-msvc.tar.gz" for Visual Studio. From that file, I copied the "Release" folder located at "Your_Folder\exiv2-0.26-msvc\dist\2015\x64\dll\Release" and pasted it in the folder of my current project. I also added manually exiv2.dll, expat.dll and zlib.dll files, which are in "Your_Folder\exiv2-0.26-msvc\dist\2015\x64\dll\Release\bin", to the project folder (I suppose there's some way to link them inside the project in Visual Studio properties, but as I said I'm pretty newbie to this subject).

2º- In Microsoft Visual Studio 2017 I changed the configuration of the solution to "Release" which was my main issue (I think) about Exiv2 installation. I used to compile my project in Debug mode and I was not aware that it was so important for the use of a particular library.

3º- With the configuration of the solution in "Release" and in the project properties, in the section "Configuration Properties/C-C++/Additional Include Directories" I added the folder "include" of Exiv2. In "Configuration Properties/Linker/General/Additional Library Directories" I wrote the address for the "lib" folder of Exiv2. And finally, in "Configuration Properties/Linker/Input/Additional Dependencies" I put the libraries: exiv2.lib, expat.lib, xmp.lib, zlib.lib.
With this configuration and, of course, using the command #include "exiv2\exiv2.hpp" in my code I have already been able to use Exiv2 properly. If there is anything that would be convenient to modify or improve from the previous procedure, Robin, please tell me and I'll change it.

My only problem now is that I'm working with .TIFF images with EXIF and XMP metadata and, for now, I can't get all the image parameters. From the examples in the documentation, I have adapted the code and some fields are still unreadable. I'll keep trying anyway!

As I said, thank you so much, Robin.
Héctor.

RE: Build Exiv2 and OpenCV libraries in a single Visual Studio C++ 2017 project - Added by H. Górriz 8 months ago

Sorry for replying myself, but I think I can't edit my last response!
Well, the code is running perfectly now. EXIF and XMP files are read from my camera. Like always, it was my fault because the library works amazingly.

Thank you so much to you, Robin, and to all your developer team.
Héctor.

RE: Build Exiv2 and OpenCV libraries in a single Visual Studio C++ 2017 project - Added by Robin Mills 8 months ago

I'm very pleased that you are happy. That's great.

(1-4/4)

Redmine Appliance - Powered by TurnKey Linux