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

SSE2 Vector Operation by Vlfeat

If you are writing something involving the math between vectors in C/C++, you may want to check out Vlfeat (http://vlfeat.org). It is designed to be a library for Computer Vision related stuff, but it also bring you a wrapper for SSE2 acceleration for vector computation. Say your original code for the calculation of vectors product

Setup dropbox without X

Assume you are accessing your server remotely through SSH. 1. Download the package, say you are using Ubuntu $wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_1.4.0_amd64.deb 2. Install the package $sudo dpkg -i *dropbox_1.4.0_amd64.deb 3. Start Dropbox $dropbox start 4. You will get an url to link your computer here, copy-and-paste into your web-browser. Restart your dropbox, all set :] $dropbox

fstream issue under 64-bits cygwin

This is a question I posted on StackOverflow: fstream issue under 64-bits cygwin, glad to get help from Nemo on Stackflow, all credits goes to him. The problem is when I use 64-bits g++ to compile the same piece of code, I get unexpected different result. The source code looks like this: #include #include using

Use a different delimiter in sed

Think about this, you want to replace “XXX” with a path like “/path/to/YYY” in a file. Your file looks like this: XXX AAA XXX Your bash script looks like this: NEW_PATH="/path/to/YYY" VAR="XXX" sed -e '{s/$VAR/$NEW_PATH/g}' your_file Well, it won’t work, since single quotes ‘ will force bash to keep variables as-is. Ok, we try to

Project-Specific Vim Configuration

Usually, we have our own vim configuration in the file ~/.vimrc What if we want one for our project? For example, we are working on certain project which needs to read in a tags file. Well, here is a possible solution. You put a line at then end of your ~/.vimrc file source ./.project.vim Then