DIP - Mini Project
DIP - Mini Project
Experiment PBL
Number
Experiment Project on region based segmentation used in Biomedical Image Processing.
Title
Resources / Hardware: Software: Matlab online
Apparatus IBM PC Compatible Computer System
Required
Objectives To understand region based segmentation using the Image Segmenter App that provides access to many
(Skill Set / different ways to segment an image.
Knowledge
Tested /
Imparted)
Theory of Performing segmentation using Image Segmenter can be an iterative process where we might try
Operation several of the segmentation options. Some segmentation techniques might work better with
certain types of images than others. After segmenting an image, we can save the binary mask.
We can also retrieve the code that Image Segmenter used to create the mask.
Manual Threshold:
Adaptive Threshold:
function [BW,maskedImage] = segmentImage(X)
%segmentImage Segment image using auto-generated code from Image Segmenter app
% [BW,MASKEDIMAGE] = segmentImage(X) segments image X using auto-generated
% code from the Image Segmenter app. The final segmentation is returned in
% BW, and a masked image is returned in MASKEDIMAGE.
% Graph cut
foregroundInd = [3124781 3153509 3153517 3153525 3153549 3153557 3153565 3153573
3182262 3182278 3182286 3211006 3211030 3211038 3211046 3239632 3239648 3239663
3239679 3239743 3239759 3239790 3267932 3267940 3267948 3267956 3267964 3267980
3268004 3268019 3268035 3268051 3268083 3268091 3268099 3268115 3268123 3268138
3268146 3268154 3268162 3268170 3268178 3268202 3268234 3268249 3268257 3268265
3268273 3268281 3268289 3296685 3296693 3379382 3407864 3407872 3407880 3407888
3407896 3407904 3407912 3407936 3407983 3407999 3408007 3408023 3408047 3408063
3408078 3408086 3408142 3436609 3436617 3436625 3436633 3551690 3580466 3666787
3691971 3720723 3720731 3749508 3778284 3807052 3807060 3807068 3807076 3835828
3835836 3835844 3864620 3893381 3893397 3922165 3922173 3922181 3950941 3950957
4062478 4062493 4091278 4120070 4148854 4206430 4235222 4235230 4264014 4292806
4350390 4379190 4407982 4461998 4490782 4519582 4577190 4577198 4605998 4634798
4634806 4663606 4692406 4692414 4721222 4721230 4750030 4750038 4778838 4778846
4804046 4804054 4804062 4804070 4832870 4976893 5034501 5232581 5290197 5319020
5319028 5376636 5405460 5463092 5491908 5491915 5574747 5690019 5690026 5718834
5718850 5776474 5805290 5834106 5834114 5862922 5891738 5916953 5916969 5945777
5945785 6032288 6061112 6089912 6089920 6118728 6118736 6147560 6176367 6259239
6288047 6489742 6518542 6576197 6605005 6605013 6630221 6630229 6659029 6659045
6745485 6831908 6860724 6860732 6889532 6975972 7029988 7260467 7289267 7289275
7318091 7346899 7346907 7372123 7429762 7545002 7545010 7545018 7545026 7573834
7660329 7689160 7689168 7717984 7717992 7743200 7743208 7743216 7772032 7800832
7800840 7800848 7800856 7800863 7800871 7800879 7800895 7800903 7800927 7800951
7800959 ];
backgroundInd = [2040094 2040158 2040205 2068823 2068831 2069045 2069061 2069085
2069093 2069101 2069108 2069116 2069124 2069132 2069140 2069156 2069164 2069204
2069227 2069235 2069259 2069275 2069291 2069299 2069315 2069330 2097591 2184649
2184657 2184673 2237849 2353992 2354000 2381761 2382808 2382816 2411624 2496890
2496898 2554458 2554474 2579642 2608426 2694795 2723563 2781139 2867492 2979036
3007820 3122965 3151749 3238101 3295662 3295678 3349646 3378430 3407222 3464806
3551182 3637567 3720351 3806743 3893135 4148719 4206319 4292711 4548287 4634679
4749879 4832671 4919071 4947871 5005471 5063063 5091863 5120663 5174663 5318663
5462663 5574271 5603071 5916279 6315895 6344695 6459927 6546351 6629175 6686806
6802062 6830870 6830878 6830886 6859709 6859725 6888525 6888541 6888549 6917365
6946181 6946197 6946204 6975012 6975028 7000244 7029060 7057884 7057908 7086723
7086739 7115587 7115603 7115634 7115642 7115658 7144601 7144617 7144625 7144633
7144641 7144656 7144672 7144680 7144704 7144736 7144775 7144823 7144831 7144839
7144847 7173663 7173686 7260197 7289005 7289013 7289021 7289029 7289045 7289053
7289061 7289101 7289108 7317908 7317916 ];
L = superpixels(X,40600,'IsInputLab',true);
% Auto clustering
s = rng;
rng('default');
L = imsegkmeans(single(X),2,'NumAttempts',2);
rng(s);
BW = L == 2;
% Fill holes
BW = imfill(BW, 'holes');
% Find circles
[centers,radii,~] = imfindcircles(X,[23
75],'ObjectPolarity','bright','Sensitivity',0.85);
BW = false(size(X,1),size(X,2));
[Xgrid,Ygrid] = meshgrid(1:size(BW,2),1:size(BW,1));
for n = 1:numel(radii)
BW = BW | (hypot(Xgrid-centers(n,1),Ygrid-centers(n,2)) <= radii(n));
end
Segment Image Using Local Graph Cut (Grabcut) in Image Segmenter:
end