how to use NMI for images

2 次查看(过去 30 天)
talayeh ghodsi
talayeh ghodsi 2020-4-4
hi every body. I am trying to use nmi.m which is attached below and downloaded from mathworks to calculate normalized mutual information between to images.
x=rgb2gray(imread('a.jpg'));
y=rgb2gray(imread('b.jpg'));
z = nmi(x, y);
but i have this error:
Error using sparse
Index into matrix must be an integer.
Error in nmi (line 19)
Mx = sparse(idx,x,1,n,k,n);
could anyone solve this error for me?
  6 个评论
Walter Roberson
Walter Roberson 2020-4-4
Replace
x = x-l+1;
y = y-l+1;
with
x = double(x-l+1);
y = double(y-l+1);
talayeh ghodsi
talayeh ghodsi 2020-4-4
thanks sir it works well

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by