Göm meny

Hints and pitfalls

Python,Matlab or C/C++?

If you have little or no experience with C/C++ programming, you should think twice before building a system based on C/C++ programming, e.g., using OpenCV. On one hand it may be a good opportunity to learn this software package, on the other hand, you may end up spending too much time to understand various subtleties of C/C++. If you instead implement in Python (or Matlab) the programming is more straight-forward but the performance (in terms of computation time) may be worse. Choose wisely!

Group Repositories

There are a few things that makes it easier to work with repositories such as GIT and SVN:

  • You may not want to check in ALL files that are generated by your project. In particular this applies to files that end with a tilde "~" or hash "#" sign, that typically are used by various editors to indicate that the file is an older version of some other file. If you do this you end up with lots of files that are meaningless in the repository and make it more difficult for you to keep track of what is going on in the project. You may also want to avoid checking in binary files (e.g. executables or PDFs) that are generated from other source files that are in the repository and are changing over time as the project develops. Otherwise it may happen that Subversion in certain cases tries to merge different versions of such files and this is usually something it fails to do.
  • DO NOT use names of files or directories with non-ASCII (e.g. Swedish) characters. They may work on some platforms and not on others.
  • DO NOT name different files or directories with the same name but differrent cases, e.g., "file.py" and "File.py". Windows platforms cannot cope with such subtleties.


OpenCV has a number of functions that, for the same function, can take parameters of different types, e.g., either float or double. However, the return type is defined by the function itself, not by the input parameters. This means that you may return variables of type double even if you input floats. A safe approach is to always use double instead of float.

If you need to solve linear homogeneous equations: Ax=0, they can be solved in OpenCV by means of the singular value decomposition (SVD) function.

Coordinate systems

Reconstuction of the camera poses and coordinates of 3D points from multiple views is typcially based on estimating relative pose between pairs of cameras which are then combined to form an absolute pose of the cameras. In this process it is vital to ensure that all transformations that are combined use the same coordinate system.

Senast uppdaterad: 2020-01-29