Code covered by the BSD License

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

### Highlights from a function with the simplest form to calculate the mutual information

5.0
5.0 | 2 ratings Rate this file 17 Downloads (last 30 days) File Size: 1.72 KB File ID: #42165 Version: 1.0

# a function with the simplest form to calculate the mutual information

by

### HU xb (view profile)

Here is a function with the simplest form to calculate the mutual information between two images.

File Information
Description

MI is a good approach to align two images from different sensor. Here is a function with the simplest form to calculate the mutual information between two images.
the function f=cal_mi(I1,I2) is in the test_mi.m file.
your comment or suggestion will be much appreciated.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
 Please login to add a comment or rating.
Comments and Ratings (3)
03 May 2016 Jorge

### Jorge (view profile)

Hi HU xb,
thank you for the code. Is all I needed for understand the Mutual Information.

I think you are using the im2 twice in the input of the cal_mi function. In the line 11 the code is:
p3 = im2(h/2-50:h/2+50,t+w/2-50:t+w/2+50); % a patch around the middle of im3

instead of:
p3 = im3(h/2-50:h/2+50,t+w/2-50:t+w/2+50); % a patch around the middle of im3

13 Mar 2016 Eyal David

### Eyal David (view profile)

Hi,

I think that there is a little mistake at the end of that function.
f = -(Hx+Hy)/h_xy; % Mutual information

I think it should be
f = -(Hx+Hy) + h_xy; % Mutual information

Comment only
08 Aug 2014 Soum

### Soum (view profile)

Hi;
Thank you HU xb very much for your code ,I have a problem my images are grayscale 32 bits '.tif' I got this error when I used your code:

Undefined function 'cal_mi' for input arguments of type 'single'.

Contact us