Skip to content

Instantly share code, notes, and snippets.

@tejus-gupta
tejus-gupta / blog.md
Last active September 21, 2017 15:40
ImageSegmentation Blog

Introduction

Over the last three months, we've been working on ImageSegmentation.jl - a collection of image segmentation algorithms written in Julia. Under the mentorship of Tim Holy, we have implemented several popular image segmentation algorithms and designed a consistent interface for using these algorithms. This blog post describes image segmentation, why it's useful and how to use the tools in this package.

Image Segmentation is the process of partitioning the image into regions that have similar attributes. Image segmentation has various applications e.g, medical image segmentation, image compression and is used as a preprocessing step in higher level vision tasks like object detection and optical flow.

Image segmentation is not a mathematically well-defined problem: for example, the only lossless representation of the input image would be to say that each pixel is its own segment. Yet this does not correspond to our own intuitive notion that

@tejus-gupta
tejus-gupta / detection.md
Created August 26, 2017 15:51
Object Detection Tutorial

In this tutorial, we will use Histogram of Oriented Gradient (HOG) feature descriptor based linear SVM to create a person detector. We will first create a person classifier and then use this classifier with a sliding window to identify and localize people in an image.

The key challenge in creating a classifier is that it needs to work with variations in illumination, pose and oclussions in the image. To achieve this, we will train the classifier on an intermediate representation of the image instead of the pixel-based representation. Our ideal representation (commonly called feature vector) captures information which is useful for classification but is invariant to to small changes in illumination and oclussions. HOG descriptor is a gradient-based representation which is invariant to local geometric and photometric changes (i.e. shape and illumination changes) and so is a good choice for our problem. Infact HOG descriptor are widely used for object detection.

We will use [this data](//Add link) for training

function median_filter{T, N}(img::AbstractArray{T, N}, window::NTuple{N, Int})
all(isodd(w) for w in window) || error("entries in window must be odd, got $window")
R = CartesianRange(size(img))
half_window = map(w->w>>1, window)
Rinner = CartesianRange(first(R)+CartesianIndex(half_window), last(R)-CartesianIndex(half_window))
for i in Rinner
if i[1] = first(Rinner)[1]