adding opencv to cmake --help-module - opencv

I like the help which is provided by --help-module. Here you can read how to add new libraries and which variables are being set. Because I only occasionally create a framework from scratch I only add libraries once and forget how to add them for the next time.
So, if I want to create a new project I only have to make a quick search with --help-module and the package I want to use. Unfortunately OpenCV is not in this list. So, I am curious if there is a way to add a help for Opencv?
TLTR; I want to add a help for OpenCV. Where I can refresh my mind on how to find opencv and how link against it etc.

I doubt this can be done.
The help module is generated from the RST CMake documentation. You are not supposed to add it there. It should be part of the documentation from the project which provides the module.

Related

Creating a custom pcore for Xilinx ISE 14.7?

A bit of a general question, but what is the most popular/common/easiest way of creating a custom pcore?
I have seen some examples and they were mostly done on Matlab and since I do not have Matlab anywhere, I am a bit lost here. There has got to be a proper way of doing without it!
Thank you in advance!!!
You can create it with VHDL or Verilog languages, but after that you need to make few files like .mdp and .pao, create directory move all the files there and then put the directory to a library.
Detailed information you can find in Xilinx Manual

How to create a library that depends on OpenCV?

If I want to create a static library that depends on OpenCV, how do I do it? The idea is to make it easier for clients to link against the library I'm creating.
I'm using CMake to create the library. For me, linking against the library is not an issue.
Clients will receive my library and they will need to use it. How do I bundle OpenCV with it?
Update: For now I'm using a .so and this solves my problem. Now, is it possible to do the same thing with.a?

Configure OpenCV on Codeblocks

I would like to use OpenCV with CodeBlocks. But I don't know to configure CodeBlocks about "Project build options". I need to precise where are the headers, and functions of openCV.
Firstly I've tried to follow this tutorial : http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/ But I had some problems in the step 4 with the configuration of makefiles. In fact, I am not very sure that I need to use cmake in order to read opencv functions.
Could you help me to configure build options ? I think I need to add "C:\opencv\build\include" about compiler on Search Directories, and about linker, what should I add ?
How add the librairy on CodeBlocks ?
Thank you
In fact CMakeLists.txt is present here : ..\opencv\sources\CMakeLists.txt
I thought CMake would have searched. Then, I use correctly Cmake and he has builded OpenCV. I don't use cygwin, I use the shell of windows. So, after that, I've tried to build the exemple of opencv code in this tutorial, and it works !
Now, when I try to build a project already coded, I don't succeed. In fact, it's a code made by an other person, it use OpenCV and C++. And there is also Java code for Android. But I would like to build and execute only C++ code.
I chose the same settings for OpenCV, but how could I know what I should add in "compiler" and "linker" section ?
Thank you for your help.
Try to change your source directory to C:\opencv\sources and see if that works.

How can I find opencv functions source code?

I am new to opencv and I am using opencv for windows. How can I see the source code for a specific function of an opencv library ? I just one want to get an idea of how that specific machine vision algorithm is implemented.
You can get the OpenCV source code from https://github.com/opencv. An easy way to find the header for a function is to open an explorer window in OPENCV_HOME\build\include (where is the location where you chose to install OpenCV) and use the search box to find the header file that contains your function - this will help you know what module it is in. Then you can search in OPENCV_HOME\modules\MODULE_NAME\src to find the source of the the function. This is even easier if you install a search tool like grepWin.
Looking at the source is almost essential for finding out why those pesky OpenCV exceptions are thrown. It also means that you can answer most things about OpenCV yourself without having to ask here.
Here is a direct link to an excellent source code search, courtesy of Github. This is a very straightforward way to find the implementation and internal usages of a function or type.
All the source is now on github:
https://github.com/opencv/opencv and you can use it's search functionalities as well.
I found the answer by Drew Noakes to be the most helpful, especially given the fact that repository structures keep changing over time.
To search in the code or in other places inside a repository using a keyword, the instructions here can be followed.
What would be even easier for first-timers however, would be to simply search for a key word in the github search bar. Then the appropriate advanced search option would generate the tags described in the the earlier linked tutorial.

How to include the boost library in a C++ application?

I'm very inexperienced with Linux and the terminal, but I'm trying to learn. I've also never included an external library before. Now I need to include the Boost.Asio library in a program being developed in Ubuntu with G++.
Could someone very kindly and very carefully explain how to go about this, from the beginning?
EDIT:
Expanding on the original question: if I need to send this code to someone else for them to run it on a completely separate machine but in the same environment, how do I take that into account? If this whole process involves literally placing library files into the same folder as the code, do I just send those library files along with the .cpp to this other person?
You have mentioned you are using Ubuntu, so the simplest way to use boost is to first install libboost-all-dev package (from synaptic), which will install everything for you including those that needed to be compiled. Then you just need to use g++ in the usual way.
Please note that whether the version is what you want, if not, you may want to install it yourself. On the other hand, boost is mostly header only library, so you only need to extract the files (right click in Ubuntu...) to a folder and link to it while compiling:
g++ hello_world.cpp -I boost_1_49_0/boost
where the last one specify the path for compiler to find the boost headers (please use absolute path).
If you want to send your program to others, dont copy only some boost files, it does not work because of the dependence. Ask them to install the same environment as you while is easy (just unzip a file...).
I don't know about your specific IDE, or about Boost.Asio specifically, but in general:
Whenever you need to link to a library, there is a file named similar to lib???.a, which you need. You need to pass the -l??? flag to g++ to link to the file.
(I'm not too familiar with the details myself, so there might be other file formats and whatnot too...)
Regarding the edit:
The "right" way would be to just have them download the library themselves, and just pass -l??? to their linker. Including Boost in your source code will make it huge, and for no good reason... it's not like you include the STL in your code, after all.
You don't include the library, but instead you declare a dependency on it. Eg. consider you use autoconf and automake then you would add AX_BOOST_BASE1 to require boost and AX_BOOST_ASIO to require the ASIO libraries. In your Makefile.am file(s) you use BOOST_CPPFLAGS and BOOST_LDFLAGS macros and rely on the ./configure to set them properly. Then whoever consumes your code will have to run the well know ./configure script which will analyze the environment for the location of boost and setup appropriate values in the build environment so that the make succeeds.
Well at least this is the theory. In practice there is a reason the whole thing is better known as autohell. Alternatives exists, like CMake or boost's own bjam. But the synopsis is always the same: you declare the dependency in your build configuration and the destination location that consumes you product has to satisfy the requirement (meaning it has to download/install the required version of boost, in your case). Otherwise you enter into the business of distributing binaries and this is frowned with problems due to richness of platforms/architectures/distributions your application is expected to be deployed in.
Obviously if you use a different build system, like ANT, then you should refer to that build system documentation on how to declare the requirement for boost.
1: ax_boost.m4 is not the only boost detecting m4 library, there are other out there, but is the one documented on the GNU autoconf list of macros

Resources