Thursday, 17 September 2015

Augmented Reality Library for MATLAB

I have developed a simple Augmented Reality library in MATLAB. By using this library, anyone with no knowledge about AR can implement the functionalities of AR  in MATLAB easily without any codings.

The only requirements from the user are,

  • 1. MATLAB R2014a or greater
  • 2. Target / Trigger Image
  • 3. Overlay Image / Video
  • 4. Image Acquisition Device
The video demonstration of the library can be found in the below video,

The library file can be downloaded from this link .


  • Download the file and change the MATLAB path to the file path
  • Call the function "ARinvoke" with appropriate arguments to render AR
  • Syntax (type in MATLAB command line):
    • ARinvoke('TargetImagePath', 1/2, 'OverlayObjectPath', 'ImageAcquisitionDeviceName', Device number);
  • Here, the second argument (1/2) means,
      • 1 for image overlay over the target image
      • 2 for video overlay over the target image

  • Example:
      • ARinvoke('C:\targetimage.jpg',1,'C:\overlayimage.jpg','winvideo',1);  // second argument - 1 -> overlay image
      • ARinvoke('C:\targetimage.jpg',2,'C:\video.avi','winvideo',1);   // second argument - 2 -> Overlay video

  • Device name (winvideo) is the webcam name in windows. You can use any camera of your choice. Use "imaqhwinfo" for list of cameras available in your device
  • Device number (1) means internal camera of laptop and (2) is external USB webcam connected. 
Currently, only 2D  objects rendering has been done. I am about to work  on 3D objects rendering and will update it once it is finished.

For now, only one image can be tracked. If anyone interested to track more than one image, feel free to contact me. 

The video being rendered (videooverlay) might be slow based on the processing speed of the Computer and MATLAB. I have increased the video framespersecond to 100 fps for better speed.

Try the library and have fun with your own custom images and videos.


  1. Replies
    1. Hi Sriharsha,

      Check out this link