Pages

Showing posts with label random. Show all posts
Showing posts with label random. Show all posts

Tuesday, 2 August 2016

Particles explained using Gifs!!

Over the past few months, I have been reading, understanding and implementing a number of existing algorithms in Computer Vision domain. Implementing particles and particle based algorithms have really had me excited and almost on the edge of my seat. One may ask what makes particles so interesting?? Let me try to get the concept through.

Particles, just like most existing algorithms in computer science, are inspired by nature. Have you ever seen a beam of sunlight coming through a window and illuminate a bunch of floating particles (impossible in London though I have seen it before)? When you see these tiny particles, you notice that they are suspended in air and that it's very difficult to predict their motion unless you disturb the surrounding air. This simple concept is vital for many computer algorithms that model motion/dynamics of an object.

Particles, along with their randomness, can be simulated inside a computer program. The simplest of such algorithm is called Random Walk, where a particle is modelled with its current position/state alone and a random displacement/jump determines its next position in time. Here I have shown one Random Walk particle:

A Single Random Walk Particle

Monday, 6 June 2016

Expectation Maximization for Gaussian Mixture Model in OpenCV

I recently wrote code for Gaussian Mixture Model (GMM) based clustering in C++. As always, I found it much convenient to use OpenCV for manipulating matrices. Although there already exist an implementation of Expectation Maximization-based GMM, I tried to understand it by writing my own implementation.

The basic idea of GMM is to first randomly assign each sample to a cluster. This provides initial mixture model for clustering. This is then optimized using Expectation - or the probability/score of assigning each sample to each component in GMM - and Maximization - or updating the characteristics of each mixture component with the given probability/score . An attractive attribute of GMM is its ability to cluster data that does not have clear boundaries for clusters. This is achieved by having a probability/score for each sample from each cluster component.

Tuesday, 17 May 2016

A Random Walk

It is fascinating to see the use of the word 'random' and its resemblance to one of the most basic ingredients in some computer algorithms. One may ask what is it that makes something random?

- "So you just made a random deal?"
- "Students were randomly chosen to take part in a drama."
- "He figured out that he still had an hour to his departure, so he went for a random walk."

Sunday, 20 December 2015

Long Exposure Shots with a GoPro and Matlab

I recently got  a GoPro. You know to get cool selfies, videos and all :D I am very much impressed by all the cool things you can do with it but was specifically impressed by the fact that one can create a time lapse video.

After giving a couple of tries to time lapse videos, I wanted to go beyond. I had always seen photographers make a long exposure shots by using specific DSLR cameras. I wanted to create just that using the only camera I had, a GoPro. However I had something much more than the camera, I knew how to write a code that deals with a number of images (I am a Computer Vision Engineer).

Wednesday, 7 October 2015

Different types of Randomness..

Randomness is an integral part of a number of programming algorithms. In fact most of my research until now has been based on a computer algorithm that only uses random numbers for learning a specific task.

A while back I was trying to write some code to define and visualize different Random number generation models. For this task I was playing with a number of different algorithms and visualizing the output on a (kind of a ) probability map. [Not to mention that I use OpenCV for this project as well].

Some of these maps looked pretty cool, so I am just embedding them in this post - also if anyone is interested I have shared the link to this project at the bottom of this post, check that and modify --> make your own random distributions :D

So the input to each of my functions is a Uniform Distribution which looks like this:
A 2D Uniform Distribution

Tuesday, 21 July 2015

"Welcome to the Virtual World...may I take your username?"

Quick note: I wrote this a long time back, but never published - thought it wasn't good enough. This just occurred to me --> it's just a post - doesnt need to be perfect right?!? So posting this now - Please be sure to leave a comment with what you think!



Over the last few years, there have been some amazing advancements in gadgets - specifically the new imaging devices have emerged and a new horizon for virtual reality has been set. These devices have opened up a door for limitless future development possibilities. "Occulus Rift", the virtual reality head-mounted device that was received with overwhelming Kickstarter response, has been the pioneer in developing the key tech that can realise the virtual reality. The reason behind this huge success is an amazing idea which transfers all your senses into a digitally created world. Although this concept has been recently recognised, the idea has been around for decades.

Sunday, 15 March 2015

Estimating Pi with OpenCV

Yesterday was Pi day where the date and time specifically corresponded to the value of Pi, i.e. 3/14/15 9:26  <===> 3.1415926 . What made this day extraordinary was how different ideas and videos came out, some explaining its significance while others showing fun ways to estimate its value.

One such video caught my eye in which @thephysicsgirl and @veritasium calculated the value of Pi using Monte Carlo sampling method but with a fun twist. Instead of using random particles they decided to use random darts and a modified dart board. They explain the idea in a very simple and intuitive way in the video.

Sunday, 6 July 2014

Déjà vu

I have been yet again busy with a lot of work, this time its quite exciting stuff.

Anyways, today I saw something really amazing that I had to share it. If you guys have seen my older posts, you might have come across a post showing the journey of my sketches. I would like to show a sketch titled "Lost!?" which I did in 2010:


This sketch was totally a creation of my imagination, I had never seen any place like this before. That is only until today, when I was left completely speechless. I  was in Hyde Park and what I saw was completely fascinating:


How did this even happen? I have no explanation to this. Undoubtedly this is a moment when you can perfectly use the phrase "Déjà vu"

Sunday, 25 May 2014

The journey of my sketches

Okay, this post is not related to anything this blog is about, however I have a feeling that this might be interesting for atleast someone.

Well when I started to write this post, it was more about how I learned to sketch with all the sketches I did and the reasons why I did them. Now after writing this post, it looks more like a journey, a journey which started sometime back. I had no skill, no proper tools, no knowledge about sketching and at some point I never thought I would do it at all. This all started one day when I was extremely bored and free, and I thought it would be cool to learn how to sketch. I started looking at other people's sketches on deviantart and tried to replicate most of the things they had done in their sketches.

My first sketch had soldiers in them. At the time I used to watch TV series "Band of brothers" and thought it would be cool to do one of the wallpapers in pencil. It was hard at first, but gradually I learned a few tricks. This was pretty basic and required not a lot of skill.

click to enlarge

Tuesday, 18 February 2014

Creating "Mood lights" animation with OpenCV

The other day I went on a typical London walk near Thames, and as always loved the lights, reflections and the view. It was amazing! One thing I really liked was the RGB mood lights on the bridge that transformed from every possible color in a way that it made the whole experience amazing!! Here is a glimpse from my instagram.



Since there was a sequence of colors involved, I thought I would at least try to replicate these mood lights using OpenCV. Turns out its not very difficult to make this animation at all. I wrote an algorithm for doing this using some clever tricks that did make it simple and interesting. Here is a gif showing how cool the animation looks when you execute the code.



Saturday, 15 February 2014

Interview experience with Google

This may sound unbelievable but it all started a few months back in late 2013, when I saw a really cool movie called "The internship". Of course I had been thinking about applying for a software eng. intern position at Google for a long time, but it was this movie which made me get up from my couch of epic laziness and start preparing for the experience that was to follow! Unlike the movie, my story doesn't end with me getting a position at all, but it certainly is about the interesting path for a learning experience. So after watching the movie, I started preparing my application and submitted it within a few days. Pretty standard details were required for submission at this point. 

Wednesday, 5 February 2014

Algorithm to check Sudoku puzzle!

I have got a couple of interviews this week, which I love preparing for as it a good way to refresh my C++ and at the same time, I get to implement some pretty interesting algorithms.

As most of us would do, I have been searching for the past few days about frequently asked interview questions and have been trying to solve most of the algorithm design questions myself. This post is about an interview question asked by google interviewers for an internship position. The question is about checking if a Sudoku Solution is correct or not.


Puzzle picture taken from: www.puzzles411.com

Friday, 6 December 2013

Google's Christmas surprise....!!

I have an android phone which automatically syncs all the photos I take to Google+ Photos.

So today we had our own christmas tree in Uni, and I took a picture to post on instagram.

After a while I checked to see that google's auto awesome feature has made a very cool christmasy effect to make the picture come alive.


What a nice surprise, interesting how google is using different image processing algorithms.

Feels like its holiday season already!!

Tuesday, 19 November 2013

Implementing Noisy TV in OpenCV...wait WHAT?!?

If you are a 90's kid like me, you must admit that back then there was nothing more annoying than losing signals on your TV. Before the age of internet, TV was the main source of entertainment. When signals were lost, all you could see was an infinite race of millions of flies on your screen (a noisy image) and making it more intolerable was the loud noisy sound of the noise.


Monday, 26 August 2013

OUT-A-TIME: What is the fourth dimension?

I have been doing my research using three dimensional datasets acquired from both real and synthetic methods. During my past research I utilized Microsoft Kinect to acquire real-world objects in their three dimensional space. On the contrary I have also used computer graphics to generate such three dimensional datasets. Some other projects I have worked on have also revolved around concepts which were vaguely related to different multi-dimensions.

Working with these multi-dimensional datasets, I have always been interested in finding out how these multi-dimensions would exist in reality (if they ever did). Here I was more interested in the question about physical space we live in. Annoyingly this has always confused me. I simple could not comprehend more than three dimensions.

For those of you who are familiar with the picture below, this post is going to be as interesting for you to read as it was for me to write.