Including OpenCV source in project without installation - c++

I'm currently trying to setup an OpenCV project using CMake.
I want to have the highest portability between machines so I thought I can achieve it by including the OpenCV source and compiling it and link it in CMake to the executable.
I'm not quite sure how to go about it because I'm a beginner to CMake and OpenCV. However, I would like to avoid installing it on the machine as much as possible as I would just want to build it and run on a machine.
So far, I've looked at the possibility of including the source of OpenCV in the CMakeFiles.txt like so:
add_subdirectory(opencv-3.1.0)
target_link_libraries(foo opencv-core)
However, it hasn't worked for me so far.
Can anyone provide me with suggestions?
Thank you.
EDIT:
The main problem I've been encountering so far is that once I use make install to move all the binaries into place, it will try to move the compiled version of OpenCV into the install location which I'm not sure how to avoid using it.

Related

Using Lapack Fortran in eclipse C++ project?

I've recently inherited a code that makes quite a lot of calls to Lapack functions, with this syntax :
F77_NAME(dgemm)(&trans,&trans,&n,&n,&n,&alpha,&D[0][0],&n,&P[0][0],&n,&beta,&temp[0][0],&n);
With the following includes :
#include <blas.h>
#include <lapacke.h>
On windows, and with eclipse CDT, the compilation works fine. I've installed Lapacke with an executable and I have had absolutely no problems with this library.
On Linux (and still with eclipse CDT), however, it's been difficult to say the least. I managed to make the include works, but I can't seem to do it for . I've managed to include but the syntax is then wrong and that would be quite long to change it all.
Do you have an idea how I could resolve this ? I've tried various thing, like linking an absolute path, but I can't find blas.h anywhere on my system despite all the libraries I installed through synaptic. Maybe I didn't install the right ones ?
Additionally, I've had some issues with github with this project. To make things short, I started developping on Windows, created the git project from there and went on. When I switched to Linux for testing purpose, I for some reason kept the windows configuration (So C:/Program Files includes, building a .exe ...), I guess I didn't set up the git properly (wouldn't be the first time) but I have no idea how to fix this ... I currently have two different git : one with the Windows configuration and the other with the Linux one .. Not ideal since we're two working on the project.
Thanks for your help !

Can not find opencv naclport build output

Sorry if this is a really dump question. I was able to build opencv for nacl using naclports. I checked-out with pepper 42 and the built it using NACL_ARCH=pnacl make opencv command and it built successfully.
But in src/out/build/opencv folder there are no much files and it is not the file structure that i have seen with regular opencv build. In include/opencv2 folder there is only one file called "opencv.hpp".
I guess i have to do something like make install but i have no idea how to do it. I tried simply running make install but no result. Please if someone can guide me how to get done the rest of the process from here and build it to use with nacl it would be a great help.
The output directory for naclports has structure that captures both the build and install results for packages (per arch) so it has a few more layers.
The installation (result of doing make install) of opencv for pnacl is in:
src/out/build/opencv/install_pnacl/payload/
That installation is also injected into the nacl sdk you're currently pointed at. So ideally, if you're building against something requiring opencv, you'll be able to do so without explicitly referencing the copy in out/.

How build harfbuzz without dependencies

I want build latest harfbuzz-ng library on Windows 7. But in build system by default I must go through long quest to gain: ragel, pkg-config, gtkdocize and other stuff. Even in the end if I get all what need for build system I get errors (sorry cannot say which concrete errors), last time I tried to build this library 2 month ago). Maybe on Linux system it is easy to get and build all this stuff but on Windows always something doesn't want to be compiled. Or the problem is that I don't find instructions which guide me on Windows, only Linux.
What I want to get is simple instructions how build only harfbuzz-ng with freetype dependency (and maybe add ICU) by MinGW compiler on Windows.
Thanks you very much.
For anyone reading this, have a look at harfbuzz.cc in the project which makes you able to use harfbuzz without any build system, just include it in one of your sources, no build system is required, define HB_NO_MT or even HB_TINY (which brings a minimal harfbuzz) if you don't use harfbuzz in multithread mode.
I don't know i this is the answer you are looking for. I am trying to work with Harfbuzz as well and did this through several attempts which did not work out for various reasons.
One (old) example you could use as a starter is: HarfBuzz static lib. The .lib-file generated works with UCDN and just needs this file plus a source for the Freetype-functions to provide the necessary FT_Face-parameter (i did this by compiling another .lib via the freetype-sourcecode (freetype.org/download.html).
But I am unsure if this will work out for the MinGW-compiler (you don't use VC++ as IDE do you??).
You may find of interest the MSYS2 build system. It is essentially a linux-style packaging system built on top of Windows(TM). You can download and install binary packages with simple commands (including automatic dependency solving). If you want to download a source package you can do that as well. http://msys2.github.io

Adding third party libraries to an OpenCV project on Xcode

I am new to the XCode environment so apologies if this sounds trivial.
I am trying to use a third party library using for OpenCV that helps me do some blob analysis, CCL etc. Hosted here
I have searched a lot but there doesn't seem to be much documentation on how to go about adding and using these new libraries. I am using XCode 4.5.2, OpenCV 2.4.2.
When I simply add all the header files to the project folder and #include them in the source code, it fails to compile. I have also tried adding the "Header Paths" but it doesn't help. What am I missing?
I have tried to follow the instructions (compiling it using the terminal but it doesn't compile too) I am not clear on how or when exactly to use CMAKE.
Any help will be appreciated. Thank you.
I would suggest you using CvBlob on google code which is different from the one on willowgarage, I have got recently confused with this so take a look at this question for alternative blob analysis libraries.
Moreover, CvBlob has also a good support community here. (Search on "[cvblobslib]" or on "[blob] [opencv]")
Try this: cvBlob: OSX installation
Once you get it compiled, you need to include the library under Link Binary with Libraries in Build Phases. (This screenshot shows the core, imgproc, and highgui libraries. Your cvBlob library would go in the same place.)

Poppler library for QT4 on windows

I am making a program in which I will include datasheets of PIC processors. I now want to display these inside the QT program itself as a widget. I wanted to use poppler for this, but I am having a very hard time trying to get hold of these binaries! I can't seem to Cmake the poppler for QT4. Could anyone help me on how to make these libraries on Windows 7.
(I have never compiled/build anything yet on Windows, only Unix, I downloaded the CMAKE program, and tried to use this to generate it with the CMakeLists.txt file, but no luck so far.)
The best solution (because this way I could learn it myself, and never have this problem again) is a 'tutorial' on how to do it myself.
If not then giving me the libraries itself would be very much appreciated!
I'd wanted to point you to SumatraPDF, but it looks like they're not using poppler any more. You could have a look at the mupdf subdirectory though, it has MSVC makefiles for several libraries required for poppler. You might have some luck adapting them for building libpoppler itself.
You could also use Cygwin or MingW to get/build poppler.
You might have to take a look at this: Poppler: Displaying PDF Files with Qt
You can use the KDEWin installer to automatically get all the appropriate binaries for your machine. This is very useful and is the strategy used in many projects (including my CarMusTy, Carnatic Music Typesetting application).
Check out: http://www.winkde.org/pub/kde/ports/win32/installer/
It automatically downloads all the required dependencies when you ask it download the required binaries. And you can get the dlls suited for your particular compiler. (MSVC, MingW supported)
Also you can get the source code for poppler. KDEWin supports versions, so you can get the latest version binaries or any previous version you like.
Check out http://windows.kde.org/ for more details.
All the best
Gopalakrishna Palem
Creator of CFugue and CarMusTy
http://gpalem.web.officelive.com/