DOC PREVIEW
Problem

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Problem D: Open and CloseInput: openclose.inOutput: openclose.outMorphological operations are tools that are used for extracting image components to represent and describeregion shapes. Two common morphological operations are open and close. Before we define these operations,we first have to define how images are represented.Given a binary image A with M rows and N columns, we can represent A as a set of the coordinates (r, c) (1<= r <= M, 1 <= c <= N) such that the pixel at the specified coordinates is 1. The coordinates of the top−leftcorner are (1, 1). We are also given a binary image B (called the structuring element) with 2S+1 rows andcolumns. The structuring element can be represented as a set as before, except that (−S,−S) are thecoordinates of the pixel at the top−left corner.Two operations important in morphological image processing are dilation and erosion. Dilation of an image Aby the structuring element B is defined by: A ^ B = { a + b | a in A, b in B } intersect Zwhere the addition of coordinates is defined componentwise, and Z is the set of coordinates (i,j) with 1 <= i<= M and 1 <= j <= N. Similarly, erosion of A by B is defined by: A v B = { w | w + b in A for every b in B }With these two operations defined, the opening of A by B is defined by A o B = (A v B) ^ Band the closing of A by B is defined by A . B = (A ^ B) v BRoughly speaking, the opening operation is used to remove small details while preserving the overall shape.The closing operation is used to fill in gaps while preserving the overall shape.InputThe input consists of a number of cases. Each case starts with a line containing the integers M, N, and Sseparated by spaces (10 <= M, N <= 256, 1 <= S <= 4). The next M lines contain the rows of the image Aspecified by N characters that are '.' (0) or '*' (1). The next 2S+1 lines specify the structuring element B in asimilar manner. The input is terminated by M = N = S = 0.OutputFor each case, print the case number followed by a blank line. Then display the result of A o B followed by ablank line, followed by the result of A . B. The format of the resulting images is the same as those of theinput images. Separate the output for different cases by a line consisting of 75 equal signs (=).Problem D: Open and CloseProblem D: Open and Close 1Sample input10 12 1..............*..........***...***...***...***...*********...**********..*********...***...*.*..........................*********10 12 1..............*..........***...***...***...***...*********...**********..*********...***...*.*...........................*.***.*.0 0 0Output for sample inputCase 1.........................***...***...***...***...*********...*********...*********...***..............................................*..........***...***...***...***...*********...**********..*********...***...***..........................===========================================================================Case 2Problem D: Open and CloseSample input 2..............*..........***....*....***...***...*********...**********..*********....**...*..........................................*..........***...***...****.****...*********...**********..*********...***...*.*..........................Problem D: Open and CloseSample input


Problem

Download Problem
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?