Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

## Search This Blog

Algorithm:-
1)
close all;
clear all;

clc;

These lines are self-explanatory.
2)Import the image→

3) Convert image to binary image, based on threshold→
BW = im2bw(I,level) converts the grayscale image I to binary image BW, by replacing all pixels in the input image with luminance greater than level with the value 1 (white) and replacing all other pixels with the value 0 (black).

https://in.mathworks.com/help/images/ref/bwlabel.html

https://in.mathworks.com/help/images/ref/regionprops.html

6)The fundamental idea is detecting max intensity area identification from a binary image →

**Note**
Find command is used to find the max intensity area.

7) ismember study matrial→

https://in.mathworks.com/help/matlab/ref/ismember.html

(It will return a matrix containing logical 1 (true) where the max intensity part is found in original
iamge. Elsewhere, the array contains logical 0 (false).

8) Dilation adds pixels to the boundaries of objects in an image. For that imdilate is
used.

9)Rest is simple plotting. Hope you will get the idea & hope

%Code:-
close all;
clear all;
clc;

bw=im2bw(img,0.7);
label=bwlabel(bw);
stats=regionprops(label,'Solidity','Area');
density=[stats.Solidity];
area=[stats.Area];
high_dense_area=density>0.5;
max_area=max(area(high_dense_area));
tumor_label=find(area==max_area);
tumor=ismember(label,tumor_label);

se=strel('square',5);
tumor=imdilate(tumor,se);
figure(2);
subplot(1,3,1);
imshow(img,[]);
title('Brain');
subplot(1,3,2);
imshow(tumor,[]);

title('Tumor Alone');
[B,L]=bwboundaries(tumor,'noholes');
subplot(1,3,3);
imshow(img,[]);
hold on
for i=1:length(B)
plot(B{i}(:,2),B{i}(:,1), 'y' ,'linewidth',1.45);
end
title('Detected Tumor');
hold off;