Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help I have no idea how to start this. Your task is to complete the labelComponents() method and implement this program, using either Depth

Please help I have no idea how to start this.

Your task is to complete the labelComponents() method and implement this program, using either Depth First Search or Breadth First Search. Submit source code and output corresponding to the given input

// componentLabeling .cpp

// image component labeling

#include

#include "make2dArray.h"

#include "arrayQueue.h"

#include "position.h"

using namespace std;

// global variables

int **pixel;

int size; // number of rows and columns in the image

// functions

void welcome()

{// Not yet implemented.

}

void inputImage()

{// Input the image.

cout << "Enter image size" << endl;

cin >> size;

// create and input the pixel array

make2dArray(pixel, size + 2, size + 2);

cout << "Enter the pixel array in row-major order" << endl;

for (int i = 1; i <= size; i++)

for (int j = 1; j <= size; j++)

cin >> pixel[i][j];

}

void labelComponents()

{// Label the components.

//

// Add Your Code Here

//

}

void outputImage()

{// Output labeled image.

cout << "The labeled image is" << endl;

for (int i = 1; i <= size; i++)

{

for (int j = 1; j <= size; j++)

cout << pixel[i][j] << " ";

cout << endl;

}

}

void main()

{

welcome();

inputImage();

labelComponents();

outputImage();

}

//componentLabeling.input.txt

7

0 0 1 0 0 0 0

0 0 1 1 0 0 0

0 0 0 0 1 0 0

0 0 0 1 1 0 0

1 0 0 0 1 0 0

1 1 1 0 0 0 0

1 1 1 0 0 0 0

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

10:16 AM Sun Jan 29 Answered: 1 week ago

Answered: 1 week ago

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago