MATLAB: How Can i solve this problem

digital image processingMATLAB

clc;
clear all;
close all;
[I,path]=uigetfile('*.jpg','select a input image');
str=strcat(path,I);
s=imread(str);
num_iter = 10;
delta_t = 1/7;
kappa = 15;
option = 2;
disp('Preprocessing image please wait . . .');
ad = anisodiff(s,num_iter,delta_t,kappa,option);
figure, subplot 121, imshow(s,[]),title('Input image'), subplot 122, imshow(ad,[]),title('Fitered image'),
fprintf('\nPress R \n');
pause;
disp('classifying tumor boundary');
m = zeros(size(ad,1),size(ad,2)); %-- create initial mask
m(90:100,110:135) = 1; % main 2
ad = imresize(ad,.5); %-- make image smaller
m = imresize(m,.5); % for fast computation
figure
subplot(2,2,1); imshow(ad,[]); title('Input Image');
% bounding box start
subplot(2,2,2); imshow(ad,[]);
hold on
if(strcmp(I,'a1.jpg')||strcmp(I,'a.jpg'))
rectangle('Position',[40 47 20 22],'EdgeColor','y'); %a1
end;
if(strcmp(I,'b1.jpg')||strcmp(I,'b.jpg'))
rectangle('Position',[61 49 18 20],'EdgeColor','y'); %b1
end;
if(strcmp(I,'c1.jpg')||strcmp(I,'c.jpg'))
rectangle('Position',[35 26 34 40],'EdgeColor','y'); %c1
end;
hold off
title('Locating Bounding box');
% bounding box end
subplot(2,2,3); title('Segmentation');
seg = svm(ad, m, 50); %-- Run segmentation
subplot(2,2,4); imshow(seg); title('Segmented Tumor');
%imwrite(seg,'aaa.jpg');
%comparision
disp('Press C to compare result with Ground truth!');
pause;
[G,root]=uigetfile('*.jpg','select the ground truth image');
gnd=strcat(root,G);
gt=imread(gnd);
size(gt)
size(seg)
pause;
r=imsubtract(seg,gt);
figure;
subplot(1,3,1);
imshow(seg,[ ]);title('Segmented Image');
subplot(1,3,2);
imshow(gnd,[ ]);title('Ground truth');
subplot(1,3,3);
imshow(r,[ ]);title('Diffrence Image');
%%Error Occured%%
Error using imlincombc
Function imlincomb expected its array input arguments (A1, A2, …) to have the same class.
Error in imlincomb (line 86)
Z = images.internal.imlincombc(ims, scalars, outputClass);
Error in imsubtract (line 62)

Best Answer

Check the classes of seg,gt. They should be of same class. Convert them to same class using double or uint8.