ICF(Integral Channel Features) + WaldBoost example (opencv, ICFDetector uses example)

Refer to this page about official reference of ICF

Other page for referencing
http://d.hatena.ne.jp/takmin/20151218/1450447204 (in Japaneses)

ICF+WaldBoost is upgraded on Google Summer of Code 2015(GSC).
And For use this, you build OpenCV included opencv_contrib.
Github address is -> https://github.com/Itseez/opencv_contrib
ICF is located in xobjdetect module.

The method to build including extra module(opencv_contrib) is refer to this page.

ICF(integral Channel Features) and ACF is feature like Haar and WaldBoost is learning algorithm like AdaBoost.
WaldBoost and ICF is a pair. For using ICF feature, WaldBoost algorithm must be run in OpenCV.

Good result Introduced in the Internet but,
Parameter settings for best learning is difficult and uncomfortable showing the learning process.

Anyway, let's find how to use it.

0. Data prepare part.
- make Positive images path list and Negative images path list.
- don't worry size and color channel, when learning these are corrected.
- But if negative image size is small(correction size I don't know), error is occurred when learning part.


1. learning part.
It is difficult to discover exact paramer values.

2. detection part.
values are scores matched rect vector.
I think 1 is best. 0 is worst.


this is some result.


Ceemple OpenCV -> Pre build and Quick start for opencv in VS 2013

Ceemple is good tool for easy start opencv in vs 2013.
If your development environment is window, vs 2013 CUDA, This is easy way that you can use the opencv.
You can just install the ceemple opencv package by installation in vs 2013 IDE.

Tools -> Extensions and Updates -> search by "ceemple opencv"
And download -> install.

After install.
Make your project by Visual C++ -> Ceemple opencv Project.

When you create this project, you don't need setting include, lib path, And you build cam draw example immediately.

But this package just support vs 2013, 64bit, window now.

Thank you.

OpenCV Background Subtraction sample code

Dear Peter

Here is your answer.
I hope this posting & source code help to you.
And This page also is good explain to use background subtraction.

This is simple code for example background subtraction.

The input is cam video.
Before get video frame, source code set some options.
MOG2, ROI, and morphology

in while, blur is option for reduce noise,
And morphology is also option.
As your project purpose and camera environment, you add more pre-processing.

But I don't add labeling code, normally do labeling processing after background subtration, because blob selecting(valid size or not), blob counting, interpretation of blob.

More information
Background subtraction code.
Labeling (findContours)http://study.marearts.com/search/label/Blob%20labeling

Thank you.

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char)
 VideoCapture cap(0); // open the default camera
 if (!cap.isOpened()) // check if we succeeded
  return -1;

 Ptr< BackgroundSubtractorMOG2 > MOG2 = createBackgroundSubtractorMOG2(3000, 64);
 //MOG2->setDetectShadows(1); //shadow detection on/off
 Mat Mog_Mask;
 Mat Mog_Mask_morpho;

 Rect roi(100, 100, 300, 300);
 namedWindow("Origin", 1);
 namedWindow("ROI", 1);
 Mat frame;
 Mat RoiFrame;
 Mat BackImg;

 int LearningTime=0; //300;

 Mat element;
 element = getStructuringElement(MORPH_RECT, Size(9, 9), Point(4, 4));

 for (;;)
  cap >> frame; // get a new frame from camera
  if (frame.empty())

  blur(frame(roi), RoiFrame, Size(3, 3));
  //RoiFrame = frame(roi);

  //Mog processing
  MOG2->apply(RoiFrame, Mog_Mask);

  if (LearningTime < 300)
   printf("background learning %d \n", LearningTime);
   LearningTime = 301;

  //Background Imge get

  morphologyEx(Mog_Mask, Mog_Mask_morpho, CV_MOP_DILATE, element);
  threshold(Mog_Mask_morpho, Mog_Mask_morpho, 128, 255, CV_THRESH_BINARY);  

  imshow("Origin", frame);
  imshow("ROI", RoiFrame);
  imshow("MogMask", Mog_Mask);
  imshow("BackImg", BackImg);
  imshow("Morpho", Mog_Mask_morpho);

  if (waitKey(30) >= 0)

 return 0;