View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Image Stitching using correlation

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

3.2 | 5 ratings Rate this file 18 Downloads (last 30 days) File Size: 1.55 KB File ID: #40848 Version: 1.0
image thumbnail

Image Stitching using correlation



This code does the task of basic image stitching using correlation technique.

| Watch this File

File Information

This matlab code reads two images and stitches them. The image registration method is done using correlation technique. A small patch of second image is taken as a mask. This mask correlates with the same size image pixels of the first image. The mask shifts and correlates. The point where the correlation is maximum (close to 1) is taken as optimum point. The point is used for stitching the second image over the first.


This file inspired Basic Three Image Stitching Code.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
23 Aug 2016 Paresh Kamble

Hello Trisha,
Send me a test mail on

Comment only
23 Aug 2016 trisha agarwal

it is for colored to gray i want colored to colored

Comment only
22 Aug 2016 Paresh Kamble

Hello Trisha,
You may find my code for three image stitching using correlation by clicking on the link of 'Acknowledgements' in 'File information' block in this page itself.

Comment only
21 Aug 2016 trisha agarwal

i want code for three image stitching using correlation..

Comment only
14 Dec 2015 Jatin Patel  
12 Nov 2013 Ramo

Ramo (view profile)

Thilina's blog is using phase-correlation though, not cross-correlation!

Comment only
08 Nov 2013 Paresh Kamble

Hello Ramiro,
I totally agree with your thought. The code was just a basic work which would show how 2 images are stitched when displaced in X direction. If you want to study a matlab code where images are displaced in both directions then you may refer to Thilina's Blog. I am providing the link below:
He has done wonderful work. Thanks for your inputs.

Comment only
06 Nov 2013 Ramiro Massol

hi Paresh
there's a major problem of your method of image stitching. If the second image is displaced not only in the X direction but also in the Y direction, then the assumption of using the maximal correlation coefficient to obtain the displacement will fail. Images to be stitched are normally displaced in both X and Y directions so it will be quite hard to use your code reliably.

27 Oct 2013 Ramo

Ramo (view profile)

Thanks, Can you explain briefly the method of Maximising image similarity using cross-correlation method please, or if you have got a useful source that explains it properly. I couldn't find good explaination online!
Thanks again

24 Oct 2013 Paresh Kamble

Dear Omar,
Thanks! I havnt yet tried for stitching 3 images. But I promise to upload the same with proper explanation in a few days.

Comment only
23 Oct 2013 Ramo

Ramo (view profile)

thanks that was helpful!
how would you go about stiching 3 images instead of 2?

09 Jul 2013 Paresh Kamble

Dear Evren Sezgin,
I guess you havn't understood that the images i have used are purely in .jpg format. Why would one need rar images to do image stitching? Is your problem statement of some different kind? Kindly reply.

Comment only
08 Jul 2013 Evren sezgin

thiscode isn't working because this image is not in rar file.

Contact us