4 years agoopencv_trail_effect.cpp: fix showing the background
Antonio Ospite [Thu, 22 Feb 2018 12:12:04 +0000 (13:12 +0100)]
opencv_trail_effect.cpp: fix showing the background

When showing the background OpenCV would fail with this message:

  OpenCV Error: Assertion failed (channels() == CV_MAT_CN(dtype)) in copyTo, file /build/opencv-lY8WRY/opencv-3.2.0+dfsg/modules/core/src/copy.cpp, line 259
  terminate called after throwing an instance of 'cv::Exception'
    what():  /build/opencv-lY8WRY/opencv-3.2.0+dfsg/modules/core/src/copy.cpp:259: error: (-215) channels() == CV_MAT_CN(dtype) in function copyTo

Initializing the background to the same format of the input frame seems
to fix this.

4 years agoopencv_trail_effect.cpp: use cv::waitKeyEx() instead of cv::waitKey()
Antonio Ospite [Thu, 22 Feb 2018 11:56:50 +0000 (12:56 +0100)]
opencv_trail_effect.cpp: use cv::waitKeyEx() instead of cv::waitKey()

In some OpenCV 3 version there was a change of behavior of cv::waitKey()
in case the delay expired with no key presses, use cv::waitKeyEx() to
rely on the old behavior.

For details see

4 years agoSegmentation.hpp: adapt the code to OpenCV 3
Antonio Ospite [Thu, 22 Feb 2018 14:15:48 +0000 (15:15 +0100)]
Segmentation.hpp: adapt the code to OpenCV 3

In OpenCV 3 the public cv::BackgroundSubtractorMOG2() is now abstract so
we cannot inherit directly from it.

The concrete class would be BackgroundSubtractorMOG2Imp from
modules/video/src/bgfg_gaussmix2.cpp but it is private so we cannot
inherit from it either.

Use the factory method as documented to get a cv::BackgroundSubtractor
instance of the desired type and use is as a property in the
MOG2Segmentation class.

4 years agoMakefile: fix detecting the compiler
Antonio Ospite [Thu, 22 Feb 2018 10:27:53 +0000 (11:27 +0100)]
Makefile: fix detecting the compiler

Rely on the compiler version, to behave "more correctly" in case CXX is
just c++.

7 years agoMakefile: fix warnings when linking with clang++
Antonio Ospite [Thu, 22 Oct 2015 09:33:30 +0000 (11:33 +0200)]
Makefile: fix warnings when linking with clang++

Clang ignores some options during linkage and warns about it:

  clang: warning: argument unused during compilation: '-ansi'
  clang: warning: argument unused during compilation: '-Wp,-D_FORTIFY_SOURCE=2'

Add -Qunused-arguments to LDFLAGS to suppress the warnings.

7 years agoFix a compilation error when using clang++
Antonio Ospite [Thu, 22 Oct 2015 09:11:37 +0000 (11:11 +0200)]
Fix a compilation error when using clang++

Clang gives this error:

  In file included from opencv_trail_effect.cpp:25:
  ./Trail.hpp:13:22: error: in-class initialization of non-static data member is a C++11 extension [-Werror,-Wc++11-extensions]
          cv::Mat *background = NULL;
  1 error generated.
  <builtin>: recipe for target 'opencv_trail_effect.o' failed
  make: *** [opencv_trail_effect.o] Error 1

Fix it to make compilation succeed.

7 years agoMakefile: fix warnings when compiling with clang++
Antonio Ospite [Thu, 22 Oct 2015 09:06:31 +0000 (11:06 +0200)]
Makefile: fix warnings when compiling with clang++

Clang does not support some options and gives warnings:

  warning: unknown warning option '-Wunsafe-loop-optimizations';
  warning: unknown warning option '-Wunused-but-set-variable';

So add them only when the compiler is not clang.

7 years agoMakefile: split compilation and linkage
Antonio Ospite [Thu, 22 Oct 2015 08:42:01 +0000 (10:42 +0200)]
Makefile: split compilation and linkage

This fixes an error when compiling with clang++:

  clang: error: cannot specify -o when generating multiple output files
  <builtin>: recipe for target 'opencv_trail_effect' failed
  make: *** [opencv_trail_effect] Error 1

The error happens because in this Makefile header files are in the
target dependencies, so they are added to the compilation command, but
clang does not support that when compiling and linking in the same

Also take care of using LIKN.cpp to link the program, as it is a C++

7 years agoREADME: fix a typo s/has showed/has shown/
Antonio Ospite [Thu, 1 Oct 2015 10:37:57 +0000 (12:37 +0200)]
README: fix a typo s/has showed/has shown/

7 years agoREADME: make the sentence about segmentation methods more specific
Antonio Ospite [Thu, 1 Oct 2015 10:36:47 +0000 (12:36 +0200)]
README: make the sentence about segmentation methods more specific

7 years agoREADME: add a link to the video showing the example trails
Antonio Ospite [Thu, 1 Oct 2015 08:04:44 +0000 (10:04 +0200)]
README: add a link to the video showing the example trails

7 years agoREADME: improve the description of requirements for a decent effect
Antonio Ospite [Thu, 1 Oct 2015 08:03:54 +0000 (10:03 +0200)]
README: improve the description of requirements for a decent effect

7 years agoREADME: improve wording about segmentation
Antonio Ospite [Thu, 1 Oct 2015 08:02:37 +0000 (10:02 +0200)]
README: improve wording about segmentation

7 years agoInitial import
Antonio Ospite [Mon, 28 Sep 2015 21:21:46 +0000 (23:21 +0200)]
Initial import