Transform rotated image to the original image

For solving part of my problem I needed to find the transformation matrix between the rotated image and its original so I told myself why not write the post in my blog about this problem. For this post I am going to show you how we can transform rotated image to the original image. Let’s start:

close all
clear all
%% Input images.
original_lena=imread('image2.jpg');
rotated_lena=imread('lena.jpg');

Detect features in both images and match the features:

Continue reading

Mobile camera as a webcam in MATLAB

lego car

Recently I bought this car and assembled it and I wanted to install wireless camera on top of that but I didn’t have wireless camera. I read in lifehacker that IP Webcam turns your Android phone into a wireless camera. So, the general solution would need two parts, one to broadcast the data from the device and another part to read this data into Matlab.

  • Install IP Webcam app from your mobile play store.
  • Open the app, tweak the settings (login/pass, resolution, image quality), set the desired resolution (will impact the speed!)
  • Scroll to the bottom and tap on ‘Start Server’
  • In the camera preview window, you can see the url at the bottom of the screen.
  • Open MATLAB and use below code to obtain a live preview window. Note that this uses JPG files for discrete frames, which is probably not the fastest way. The app can stream the video and/or audio in multiple ways.

mobile camera image

Continue reading

Background subtraction

Background subtraction, also known as Foreground detection, is a technique in the fields of image processing and computer vision wherein an image’s foreground is extracted for further processing (object recognition etc.). Generally an image’s regions of interest are objects (humans, cars, text etc.) in its foreground. Background subtraction is a widely used approach for detecting moving objects in videos from static cameras. The rationale in the approach is that of detecting the moving objects from the difference between the current frame and a reference frame, often called “background image”, or “background model.

The basic method of background subtraction is to compare |frame – background| with
a pre-defined threshold (theta). If the difference of a pixel is larger than theta, then classify it as foreground; otherwise, claim that it is background.

(video dataset)

Continue reading

Create your own summer pictures!

When you don’t have time and money to go for summer vacation, take pictures and show them to your friends. One way is to make your summer vacation pictures at your office!! How? easy, you just need Matlab, pc, part of the two amigos code and creativity!

Here, my summer vacation pictures are ready 😀

vacation

 

Continue reading