Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design, develop, and test a program that labels groups of connected pixels in a binary image. For this project, a binary image will be
Design, develop, and test a program that labels groups of connected pixels in a binary image. For this project, a binary image will be represented as a 2-D array of r rows and c columns of characters. A.' character represents a black pixel and a character represents a white pixel. A group of white pixels are said to be connected if they share a common north, south, east or west edge (not diagonal). For example, in the following 8 x 10 image... **. **** ** one such coloring would be the following... ...bb....a .... ....c..d.. .e...d.. .dd. .ff. There are two groups of one pixel (c and e), three groups of two pixels (a, b and f) and one group of four pixels (d). Your program is to "color" the white pixels with a unique alphabetic character that identifies all the 4-way (north, south, east and west) adjacent pixels in a common connected component. Your program must implement a recursive solution to find the connected components. 2 Input Your program will read several images from keyboard input. The following is the input format: 1. An integer n indicating the number of images that follow. 2. Two integers r and c representing the dimensions (rows and columns) of the image. 3. The image characters consisting of r rows and c characters per row. 4. A blank line will separate each image. For example, the following input is valid. 2 3 3 *. ** *.. 8 10 ** ** Here is the output for the above sample input. a.. .bb C.. 1 2 2 1 ...bb. ....c..d.. ...e...d.. a b.. .cc a.. a 1 2 2 3 4 1 linux$ The grader will strictly follow the aforementioned input and output format specifications. . Have sufficient comments in your code to facilitate others to understand it. Compress your solution in a .zip file and submit it on TCU Online. The .zip file name is of your choice. This project is worth 100 points.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started