hw3solutions_2

# hw3solutions_2 - SIMG-782 Introduction to Digital Image...

This preview shows pages 1–6. Sign up to view the full content.

SIMG-782 Introduction to Digital Image Processing Homework 3 – Due October 1, 2004 1. A binary array that represents a portion of a black and white image is given below. Perform the operations listed below on this piece of image. Assume that all of the pixels that surround this segment contain black background. 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 (a) Dilation with the structuring element ± 1 1 1 The origin is shown with a circled element. Generate the image array 1 h hw3prob1solutions.pro 1 i≡ 2 . ;SIMG-782 FALL 2004 ;HOMEWORK 3 SOLUTIONS PRO hw3P1 ;PROBLEM 1: First construct the number array that represents the image. A=[[0,0,0,0,0,0,0],[0,0,1,1,0,0,0],[0,0,0,1,0,0,0],[0,0,0,1,1,0,0],\$ [0,0,1,1,1,1,0],[0,0,1,1,1,0,0],[0,1,0,1,0,1,0],[0,0,0,0,0,0,0]] B1=[1,1,1] C1=Dilate(byte(A),byte(B1),0) print,format=’("Structuring Element B1=[",3i1,"]")’,B1 print,’C1=dilate(A,B1,0)’ print,’ A C1’ print,[A,C1],format=’(7i1,1x,7i1)’ This code is written to ﬁle hw3prob1solutions.pro .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This produces the following output. Note that the formatting somewhat reduces the amount of space required. We use the “0” argument in dilate to specify the origin location. Note that IDL does gives the wrong value in position C 1 [6 , 6], which should be a 1. Structuring Element B1=[111] C1=dilate(A,B1,0) A C1 0000000 0000000 0011000 0011110 0001000 0001110 0001100 0001111 0011110 0011111 0011100 0011111 0101010 0111110 0000000 0000000 (b) Erosion with the structuring element ± 1 1 1 This can be done with the following code: 2 h hw3prob1solutions.pro 1 i + / 1 3 . C2=erode(A,B1,0) print,’C2=erode(A,B1,0)’ print,’ A C2’ print,[A,C2],format=’(7i1,1x,7i1)’
C2=erode(A,B1,0) A C2 0000000 0000000 0011000 0000000 0001000 0000000 0001100 0000000 0011110 0011000 0011100 0010000 0101010 0000000 0000000 0000000 (c) Dilation with the structuring element 1 ± 1 0 1 3 h hw3prob1solutions.pro 1 i + / 2 4 . B2=[[1,1],[0,1]] C3=dilate(A,B2,1,0) print print,format=’("Structuring Element=",//(2i1))’,B2 print print,’C3=dilate(A,B2,1,0) print,’ A C3’ print,[A,C3],format=’(7i1,1x,7i1)’

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
The result is Structuring Element= 11 01 C3=dilate(A,B2,1,0) A C3 0000000 0000000 0011000 0111000 0001000 0011000 0001100 0011100 0011110 0111110 0011100 0111110 0101010 1111110 0000000 0101010 (d) Erosion with the structuring element 1 ± 1 0 1 4 h hw3prob1solutions.pro 1 i + / 3 5 . C4=erode(A,B2,1,0) print,’C4=erode(A,B2,1,0)’ print,’ A C4’ print,[A,C4],format=’(7i1,1x,7i1)’
The result is C4=erode(A,B2,1,0) A C4 0000000 0000000 0011000 0001000 0001000 0000000 0001100 0000100 0011110 0001100 0011100 0001000 0101010 0000000 0000000 0000000 (e) Opening with each of the above structuring elements. 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 19

hw3solutions_2 - SIMG-782 Introduction to Digital Image...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online