# K-Nearest Neighbours: Classify (recognize) things

Recognizing things is a common problem in machine learning. Even in the SuDoKu Solver demo, we require a mechanism to identify digits in the SuDoKu grid. To do this, we’ll use a simple algorithm called K-Nearest. It’s one of the simplest machine learning algorithms. The results aren’t going to be robust, but we’ll get some […]

# Obstacle avoidance with the Bug-1 algorithm

Obstacle avoidance is an indispensable behavior in mobile robots. If a robot has no sensors, it’s a blind robot. If it has proximity sensors but still it keeps hitting whatever comes in its way, then it’s a ‘’brainless’’ robot. Imagine an ant or any insect walking on the ground. The insect is heading towards a […]

# Timing macros in C/C++

Often you need to calculate the time it takes to execute a certain set of operations. And if you’re trying to optimize your code, you’ll need this even more. So here’s a set of useful  macros that can help you do that (without any plumbing). The Timing Macros These macros use the OpenCV functions cvGetTickCount() […]

# K-Means clustering in OpenCV

K-Means is an algorithm to detect clusters in a given set of points. It does this without you supervising or correcting the results. It works with any number of dimensions as well (that is, it works on a plane, 3D space, 4D space and any other finite dimensional spaces). And OpenCV comes with this algorithm […]

# K-Means clustering

K-Means is a clustering algorithm. That means you can “group” points based on their neighbourhood. When a lot of points a near by, you mark them as one cluster. With K-means, you can find good center points for these clusters. This “clustering” is not limited to two dimensions. You can have points in 3 dimensions. […]

# Linear separability

Linear separability is an important concept in neural networks. The idea is to check if you can separate points in an n-dimensional space using only n-1 dimensions. Lost it? Here’s a simpler explanation. One Dimension Lets say you’re on a number line. You take any two numbers. Now, there are two possibilities: You choose two […]

# Solving for intersection of lines efficiently

One of the most common tasks done with lines is detecting their intersection. For some reason, not many people know how to do that on a computer. In this post, I assume you have some lines. You got them from some algorithm, or the user supplied them, or whatever. And you want to find the […]

# Converting lines from normal to slope-intercept form

Several algorithms return lines in the normal form (like The Hough transform) while other algorithms may require these lines in another format (like drawing a line on screen). The slop-intercept form of lines is widely known, and you can easily convert a line in slope-intercept form to other forms. So knowing how to efficiently do […]