Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement (write a program) an algorithm to find the connected components in a binary image using Disjoint-Set data structure in a). An ASCII

Design and implement (write a program) an algorithm to find the connected components in a binary image using Disjoint-Set data structure in a). An ASCII file containing a binary image is available (see girl.img and img readme) as the input of your program. The output of the program should be the following in this specified order: 1. the input binary image, 2. the connected component image where each component is labelled with a unique character, 3. a list sorted by component size, where each line of the list contains the size and the label of a component, 4. same as 2 with the connected components whose sizes are less than three deleted.

girl.img

+++++++++ +++ +++++++++ +++ ++++++++ +++ +++++++ ++++ ++++++ ++ ++++ +++++ ++ ++++ +++ ++ +++++ ++ ++ + + +++++ ++ ++ + ++++ ++ ++++++ +++++ + ++++ ++++++++ +++ ++++++ +++++ + ++++++ ++++++++++ +++++ +++++++ +++ + +++++++++++++++ +++++ ++++++++ ++ + + +++++++++++++++++ +++ +++++++++ +++ ++ ++++++++++++++++++ ++ ++++++++++ + +++ + +++++++++++++++++++ +++ +++++++++++ + ++ +++ ++++++++++++++++++ + +++ ++++++++++++ + + ++ ++++++++++++++++++ + ++++ +++++++++++++ ++++ ++ +++++++++++++++++++++ ++++ ++++++++++++++ +++++ ++++++++++++++++++++++ ++++ ++++++++++++++ ++++++ +++++++++++++++++++++ ++++ +++++++++++++ ++++++++++++++++++++++++++ ++++ +++++++++++++ +++ ++++++++++++++++++++ ++++ ++++++++++++ +++ ++++++++++++++++ ++ ++++ ++++++++++++ + +++++++++++++++++++ +++++ ++++++++++++ + +++++++++++++++++++ +++++ +++++++++++ +++++++++++++++++++ + + +++++ +++++++++++ ++++++++++++++++++++ +++++ +++++ +++++++++++ +++++++++++++++++++ ++++ +++++++ +++++++++ ++++++++++++++++++++ +++++++++++ +++++++++ +++++++++ +++++++++++++++++++ ++++++++++ + +++++++++++ +++++++++ ++++++++++++++++++ +++++++ +++++ ++++++++++++ ++++++++ ++++++++++++++++++ +++++++ +++++ +++++ +++++++ ++++++++ +++++++++++++++++ +++++++ ++++ + ++ +++++++ ++++++++ ++++++++++++++++ + +++ +++ ++++++++ +++++++ +++++ ++++++++++ + ++ +++ ++++++++++ +++++++ ++++++ +++++++++ +++ ++ +++++++++ +++++++ ++++++ ++++++++ ++++ ++ ++++++++ +++++++ +++++ ++++++++ ++++ ++ ++++++++ +++++ +++++++ +++++++ +++++ + ++++++++ +++++ +++++++ ++++ ++++++ + ++++++++ +++++ ++++++++++++++ ++++++ ++ +++++++ ++++ +++++++ + ++ +++++++ ++ ++++++++ ++++ +++++++ +++++ ++++++++ ++ +++++++ ++++ +++++ +++++ +++++++++ ++ + ++++++++ +++ ++++++++++ ++++++++++ ++ ++ +++++++++ ++ +++++ ++++ +++++++++++ +++++++ +++++++++ ++ ++++++++++ +++++++++++ ++++ ++++++++++ ++ + +++++ + +++++++++++++ ++++++++++ + +++++ + +++++++++++++ ++++++++++ + +++++ + ++++++++++++++ +++++++++++ + ++ ++ +++++++++++++++ +++++++++++ ++ + +++++++++++++++++ +++ +++++ +++ +++++++++++++ ++ + +++++++++++++++++ ++++++++++ ++ +++++++++++++ + + +++++++++++++++++++ +++++ ++++++++++++++ + ++++++++++++++++++++ ++++ ++++++++++++++ +++++++++++++++++++++ ++++++ +++++++++++++++ ++ +++++++++++++++++++++++ +++++++++++++++ ++ +++++++++++++++++++++++ ++++++++++++++++ +++ +++++++++++++++++++++++++ ++++++++++++++++ +++++++++++++++++++++++++++++ ++++++++++++++++ +++++++++++++++++++++++++++ +++++++++++++++++ + ++++++++++++++++++++++++ ++++++++++++++++ ++ + ++ ++++++++++++++++++++++ +++++++++++++ +++++ ++++ +++++++++++++++++++++++ ++++++++++++ +++++++ ++ + ++++++++++++++++++++++ ++++++++++ +++++ ++ ++ +++++++++++++++++++++ +++++++++ +++ + + + ++++++++++++++++++++ ++++++ ++ + +++++++++++++++++++++ ++++++ ++ ++ +++++++++++++++++++ +++++ +++ ++ ++++++++++++++++++ ++++ +++ ++ +++++++++++++++++++ ++++ 

and img -readme

File girl.img contains a 71 by 71 binary image in plain text. In this file, a + means 1 and a space means 0. We only consider the connected components of 1. The total number of components is less than 26. Therefore you can use letters from 'a' to 'z' to identify all the components. We use 4 connectivity for +. Therefore ++ and + are considered connected. + However + and + are not considered connected. + +

in java please

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

Define and discuss the nature of communication

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago