Tag: en

[OpenCV] detectMultiScale: output detection score

OpenCV provides quite decent implementation of the Viola-Jones Face detector. A quick example looks like this (OpenCV 2.4.5 tested): // File: main.cc #include using namespace cv; int main(int argc, char **argv) { CascadeClassifier cascade; const float scale_factor(1.2f); const int min_neighbors(3); if (cascade.load("./lbpcascade_frontalface.xml")) { for (int i = 1; i < argc; i++) { Mat img

On 2 dimensional array of C++

I was asked about this today. In practice, I rarely use 2-dimensional array, instead I use vector of vectors. To allocate a 2-d array on the stack, a C-style array is int d[2][3]; Then to refer to an element it is like d[i][j]; To make a dynamical allocation, one can NOT write his code like

[OpenCV]detectMultiScale

I met a problem when using the interface ‘detectMultiScale’ of OpenCV. The rectangles it gives out may not be fully inside the frame of the original image. As a result, if these rectangles are applied directly on the original image to crop out the detected objects, your programs crash. These are the interfaces virtual void