GLASS STAIN FILTER


iPython/ Numpy/ Scipy | WINTER 2016

 IMAGE FILTER DESIGN TO GIVE A GLASS STAIN FILTER DESIGN USIN VORONOI CELLS.

iPython Notebook


INPUT IMAGE

img2.png

OUTPUT IMAGE

ambika.png


The project objective is to develop an image filter to produce a glass stain effect (which is a bit similar to a bokeh effect applied on images ). The following are the steps to achieve this objective:

  1. Segment the image into sections of size blocksize and call each section a region.
  2. Generate a random x,y co-ordinate in every region, these are the Voronoi points.
  3. Using one of the distance algorithms ( euclidean, chebychev or manhattan ), assign every pixel a region. These regions are called vornoi regions.
  4. Assign all the pixels in one region the same color . The color can be dervied by the mean ,median or mode of the pixel color values in the region.

p_x,p_y – co-ordinates of every pixel

v_x,v_y – co-ordinates of region vornoi point

EUCLIDEAN DISTANCE : sqrt((p_x-v_x)^2+(p_y-v_y)^2)

CHEBYCHEV DISTANCE : max (|p_x-v_x|,|p_y-v_y|)

MANHATTAN DISTANCE : |p_x-v_x|+|p_y-v_y| (looks like road structures in Manhattan )