## Particle filters with Python Particle filters comprise a broad family of Sequential Monte Carlo (SMC) algorithms for approximate inference in partially observable Markov chains. The objective of a particle filter is to estimate the posterior density of the state variables given the observation variables. A generic particle filter estimates the posterior distribution of the hidden states using the observation measurement process.

Posted in Uncategorized | 3 Comments

## Kd-tree and Nearest neighbor (NN) search (2D case)

A Kd-tree, or K-dimensional tree, is a generalization of a binary search tree that stores points in a k-dimensional space. In computer science it is often used for organizing some number of points in a space with k dimensions. Kd-trees are very useful for range and nearest neighbor (NN) searches, it is a very common operation in computer vision, computational geometry, data mining, machine learning, DNA sequencing. In the current post we will deal with point sets in the two-dimensional Cartesian space, so all of our Kd-trees will be two-dimensional.

Posted in Uncategorized | 3 Comments

## Robust linear model estimation using RANSAC – Python implementation

RANSAC or “RANdom SAmple Consensus” is an iterative method to estimate parameters of a mathematical model from a set of observed data which contains outliers. It is one of classical techniques in computer vision. My motivation for this post has been triggered by a fact that Python doesn’t have a RANSAC implementation so far. Posted in Uncategorized | 2 Comments

## Convex hull: how to tell whether a point is inside or outside?

In this post we will talk about convex hulls which have a broad range of applications in mathematics, computer science and surely image processing / computer vision. In mathematics the convex hull (sometimes also called the convex envelope) of a set of points X in the Euclidean plane or Euclidean space is the smallest convex set that contains X. More details about the convex hull theory can be found on this Wikipedia page which is always a very good start for learning things;-) Convex hulls are very common in image processing and computer vision though, I presume that almost every “image processor” has already faced in his career a need to find a polygon of a given point-set, no matter in what kind of application. Usually the convex hull needs to be built as fast as possible and the most common operation with the polygon is detection whether some random point is inside it or not. Exactly this problem we are going to solve now, and, as usual, we will write some Python code doing this for us. Posted in Uncategorized | 2 Comments

## Python: putting segments on top of the input image

Assume you are working on the image /video segmentation problem. Sooner or later a day is  coming when you need to present your (hopefully good) results to other people on a conference, project meeting, in a paper, whatever. Usually segmentation results are represented by a matrix of integers standing for region labels which are supposed to be unique. A colored representation of segments is derived by assignment of unique colors based on region labels.  In this post I will show you a simple trick how you can impress the audience with your segmentation results without any changes in your segmentation method. Using Alpha Compositing you can combine an input image with colored segments as it’s shown below:   ## Robust Least Squares for fitting data (quadric surface)

Here I would like to show you some changes in the source code of the Robust least squares fitting required for a general quadric surface (fitting of the planar model was introduced here). Assume you want to fit a set of data points in the three-dimensional space with a general quadric described by five parameters $\bf{a_{1}}$, $\bf{a_{2}}$, $\bf{a_{3}}$, $\bf{a_{4}}$, and $\bf{a_{5}}$ as a function of $\bf{x}$ and $\bf{y}$ in the following way: $\bf{z = a_{1}x^{2} + a_{2}y^{2} + a_{3}x + a_{4}y + a_{5}}$. Posted in Uncategorized | 1 Comment

## Robust Least Squares for fitting data (planar surface)

Damn, it’s a good while ago since the last activity on this blog…! In the future I will try to avoid such long breaks, as it’s also very useful for me to make notes about last approaches / news / papers / tendencies in the computer vision (CV) society. Today I have an interesting and (hopefully) useful topic. Sooner or later working in the CV domain you face the problem of fitting data to the model. Let’s assume that you have a response data coming from somewhere (or somebody) and want to find a model for it. 