Download presentation
Presentation is loading. Please wait.
Published byOwen Gibson Modified over 6 years ago
1
Set operations A=imread(‘utk.tif’); B=imread(‘gt.tif’); Ex#1: Perform
(a) Complement of A (b) Union of A and B (c) Intersection of A and B (d) Set difference A-B Hint: help & for other logical operators
2
Dilation Ex. Ex. Dilate broken-txt.tif with b a=zeros(10,10);
a(4:7, 4:7)=ones(4,4); b=[0 1 0; 1 1 1; 0 1 0]; c=imdilate(a,b);
3
Dilation (cont.) t=imread(‘text.tif’); sq=ones(3,3);
td=imdilate(t,sq); Exercise#2: Dilate twice Dilate 3 times Dilate once with diamond structuring element Dilate once with 5x5 square 0 1 0 1 1 1
4
Erode Command: imerode Ex#3: generate the following images
original image erosion dilation small-squares.tif 13x13 square
5
Boundary detection rice=imread(‘rice.tif’); r=rice > 110; A-(A B)
Exercise#4: produce Internal boundary: A-(A B) - External boundary: (A B)-A + Morphological gradient: (A B)-(A B) + -
6
Opening and closing I=imread('shapes.tif'); b=ones(20, 20);
f=imopen(I, b); g=imclose(I, b);
7
Opening and closing (cont.)
Ex#5: Generate the following images open close noisy-fingerprint.tif
8
Hit-or-miss transformation
; ; ; ; ; ; ] Ex6: Generate the right images
9
Region filling Sample code: function out=regfill(im, pos, kernel)
current=zeros(size(im)); last=zeros(size(im)); last(pos(1), pos(2))=1; current=imdilate(last, kernel) & ~im; while any(current(:) ~= last(:)), last=current; end; out=current; Exercise#7: Perform boundary detection to nicework.tif, then apply region filling to it, modify regfill using getpts
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.