# Calculating angle and direction between two vectors

Normally, if we were to find the angle between two vectors, say up-vector and dir-vector, what we would do is to do a dot product between them. Since

$a \cdot b = |a||b| \cos{\theta}$ and

$\cos{\theta} = \frac{a \cdot b}{|a||b|}$

However, since the calculated angle is the smallest / nearest angle between the two vectors, we can’t derive the (rotational) direction of one vector from the other. Thus in the following figure, it’s hard to figure out whether the direction vector is on the left or right of the up vector. The angle between two vectors calculated using dot product is always between 0° to 180°, thus we are not able to derive the direction from it. Continue reading

# Rest in Peace Ryan Davis

Rest in Peace Ryan Davis

I’m at loss at words for the past 13 hours. I’ll probably write more when I’m in better state of mind later on.

# Simple and fast Gamma Correction on OpenCV

I’m amazed at how hard it is to find a simple and fast gamma correction code on OpenCV.

# PS: I’m still very busy with master thesis.

PS: I’m still very busy with master thesis.

Trying to train cascade classifiers for my HoG based detector takes up the entire CPU resources and the whole day to train a sample version. Thus I ended up diverting my attention to University’s PC instead, however compiling OpenCV and making opencv_traincascade run without error is not a simple task. Let’s see how it goes.

The HoG detector works though, just that it’s too slow without using cascade classifier. Continue reading

# Configuring Sublime to work with OpenCV on Mac

So, I just bought Sublime Text from http://www.sublimetext.com, which is supposed to be a very good cross platform text editor. I’ve been programming OpenCV applications using XCode, but rarely using editor or even compiling it from command line.

However, after tinkering a bit, I’ve managed to create a this built system for Sublime, which should allow you to compile and run OpenCV / C++ application from it. Just go to Tools > Build System > New Build System

My OpenCV was installed using HomeBrew, which has pkg-config information for opencv already created inside /usr/Local/Cellar/opencv/2.4.4/lib/pkgconfig/, thus you can utilize pkg-config to generate the include and library flags for g++ from it.