Implement the 8-connected component algorithms

Assignment Help Data Structure & Algorithms
Reference no: EM132372632

Homework: You are to implement the 8-connected component algorithms as taught in class in Java and C++.

Language: Java and C++

I. Input (args[0]): A binary image.
II. Outputs:
- outFile1 (args[1]):** (include in your hard copy)
- Pretty print the result of the Pass-1 *and*
the EQAry with proper captions
- Pretty print the result of the Pass-2 *and*
the EQAry with proper captions
-Print EQAry after manage the EQAry
- Pretty print the result of the Pass-3 *and*
the EQAry with proper caption
// a proper caption means the caption should say what the printing is.

- outFile2 (args[2]): ** (include in your hard copy)
the labelled image file from the result of Pass-3
with header information for your next project.

- outFile3 (args[3]):** (include in your hard copy)
To store the connected component properties.
The format is to be as below:
- 1st text-line, the header of the input image,
- 2nd text-line is the total number of connected components.
- from 3rd text, use four text-lines per each connected component:
- label
- number of pixels
- minRow, minCol //the r c coordinated of the upper left corner
- maxRow, maxCole //the r c coordinated of lower right corner
For an example:
45 40 0 8 // image header
8 // there are a total of 8 CC in the image
1 // CC label 1
187 // 187 pixels in CC label 1
4 9 // upper left corner of the bounding box at row 4 column 9
35 39// lower right corner of the bounding box at row 35 column 39
:
:

 

 


*******************************
III. Data structure:
*******************************
- numRows (int)
- numCols (int)
- minVal (int)
- maxVal (int)
- newMin (int)
- newMax (int)
- newLabel (int)
- zeroFramedAry (int **) // a 2D array, need to dynamically allocate
//at run timeof size numRows + 2 by numCols + 2.

- numNb (int) // number of neighbors to be looked at.
// For 8-connectness is set to 5

- NonZeroNeighbor [numNb] (int)
// 1-D array to store pixel(i, j)'s non-zero neighbors

- EQAry (int *)
// an 1-D array, need to dynamically allocate at run time
// of size (numRows * numCols) / 4
// and initialize to EQAry[i] = i.

- Property (you may use 1D struct or class)
- label
- numpixels
- minRow
- minCol
- maxRow
- maxCol

- CCproperty (*Property) // a array of 1D property struct/class

- methods:
- constructor(s) // need to dynamically allocate all arrays;
and assign values to numRows,..., etc.
- zeroFramed // zero framing the image as taught in class
- loadImage // read from input file and writeto zeroFramedAry begin at(1,1)

- (int) loadNonZero (whichPass, i, j, extraLabel, minLabel, diffLabel)
// This method load non-zero neighbors of given p(i,j)
// with respect of whichPass (pass1 or pass2).
// extraLabel set to 0 in pass 1, meaning, it does not include p(i,j)
// and set to p(i,j) for pass-2, meaning, it includes p(i,j)
// during the loading, it determines the minLabel and number of
// different labels.
// The method returns the number of non-zero neighbors
// You should be able to write this method on your own.

- Connect8CC_Pass1// as taught in class
//suggested algorithm steps are given below.

- Connect8CC_Pass2 // as taught in class
//suggested algorithm steps are given below.

- Connect8CC_Pass3 // In the pass3, you will use the EQAry
// to relabel the components;
// keep track the newMin newMax for the label image header
// as well as compute the property of each c.c.
// and store the cc label i's properties toCCproperty[i]
// please note that the bounding box is computed from
// zeroFramedAry, therefore, the actual
// (minRow, minCol, maxRow, maxCol)
// need to be subtract by 1 for these four numbers.
// You should be able to implement this method.

- updateEQ (...) // Update EQAry of all non-zero neighbors to minLabel
- manageEQAry (...) // algorithm was given in class.

- printCCproperty // print the component properties.

- prettyPrint (outFile) // prettyPrintzeroFramedAry
//without the extra rows and columns to outFile

- printEQAry // Print EQAry with index up to newLable, not beyond.

*******************************
IV. main(...)
*******************************

step 0: inFile ← open the input file
numRows, numCols, minVal, maxVal ←read the image header
dynamically allocate zeroFramedAry and initialize to zero.
outFile1, outFile1, outFile3← open

step 1: loadImage(inFile,zeroFramedAry)
// read from input file and writeto zeroFramedAry begin at(1,1)

step 2: Connect8CCPass1 (...) // suggested algorithm steps given below.
prettyPrint(outFile1) // the result of pass1
printEQAry (outFile1)// with index up to newLable with proper caption

step 3: Connect8CCPass2 (...)//suggested algorithm steps given below.
prettyPrint (outFile1) // the result of pass2
printEQAry (outFile1) // with index up to newLable with caption

step 4: manageEQAry (...)// algorithm was given in class.
printEQAry (outFile1)// with index up to newLable with caption

step 5: 8ConnectCCPass3 (...) // see description in the above.
prettyPrint (outFile1) // the result of pass3
printEQAry (outFile1) // with index up to newLable with caption

step 6: output numRows, numCols, newMin, newMax to outFile2

step 7: Output the result of pass3 from zeroFramedAryto outFile2,
begins at (1, 1) and ending at ??

step 8: printCCproperty (...)to outFile 3

step 9: close all files

*******************************
V. ConnectCCPass1 (...)// suggested algorithm steps.
*******************************
step 0: newLabel ← 1

step 1: scan zeroFramedAry L to R & T to B (inside the frame)
if zeroFramedAry (i, j) <= 0
repeat step 1

step 2: numNz← loadNonZero(i, j, 0, minLabel, diffLabel)
case 1: if numNz == 0
zeroFramedAry (i, j) ← newLabel
newLabel ++

case 2: if numNz>0 && diffLabel == 1
zeroFramedAry (i, j) ← minLabel

case 3: if numNz>0 && diffLabel > 1
zeroFramedAry (i, j) ← minLabel
updateEQ (minLabel)

step 3: repeat step 1 to step 2 until all pixels are processed

*******************************
V. ConnectCCPass2 (...)// suggested algorithm steps.
*******************************
step 1: scan zeroFramedAry R to L & B to T (inside the frame)
if zeroFramedAry (i, j) <= 0
repeat step 1

step 2 numNz← loadNonZero(i, j, zeroFramedAry (i, j), minLabel, diffLabel)
if numNz>0 && diffLabel > 1
zeroFramedAry (i, j) ← minLabel
updateEQ (minLabel)

step 3: repeat step 1 to step 2 until all pixels are processed


*******************************
V. drawBoxes(zeroFramedAry, CCproperty)
*******************************

step 1: index ← 1

step 2: minRow ←CCproperty[i].minRow // need to add 1
minCol ←CCproperty[i].minCol // need to add 1
maxRow←CCproperty[i].maxRow // need to add 1
maxCol ←CCproperty[i].maxCol // need to add 1
label ←CCproperty[i].label

step 3: Assign all pixels on minRow from minCol to maxCol ← label
Assign all pixels on maxRow from minCol to maxCol← label
Assign all pixels on minCol from minRow to maxRow ← label
Assign all pixels on maxCol from minRow to maxRow ← label

step 4: index++

step 5: repeat step 2 - step 4 while index is within the number of cc.

There are 12 key requirement for this homework. Please ready carefully before you accept this order.

(1)Must use Visual Studio 2019 for this homework (this can be downloaded for free in the Internet)
(2) Need to use Java and C++ two languages. That means needs two source files: Java source file and C++ source file (.cpp).
(3) Java source code deadline: 9/15/19 Midnight. Only one Java source code to create all required output files.
(4) C++ source code deadline: 9/16/19 Midnight. Only one C++ source code to crate all required output files.
(5) Cannot be separated into more than one source doe. Can be compiler. This program does need any command line argument when running their compiler source code (.exe)
(6)Need to use the same variable name and function name as the name in the document. Cannot use your own names of variable and functions.
(7) Must follow the instruction for each step in the document:
(8) Need to step by step to follow all requirement in the document.
(9) Need to give key and reasonable explanation on the source code.
(10) Need to write 10 - 15 pseudo code linesfor this homework.
(11) Finally, send me all files including: source file, complier file, output files, screen shot output files.
(12) Tech support response time should bye 0 - 12 hours, not 0 -24 hours, because the deadline is close.

Attachment:- connected component algorithmsas.zip

Reference no: EM132372632

Questions Cloud

Experienced a pertussis outbreak this year were divided : It should be administered every 8 years in order for it to remain effective. A random sample of 500 people living in a town that experienced a pertussis
What is the probability that the sample mean : The cost of 5 gallons of ice cream has a variance of style="color:inherit;">36 with a mean of 35 dollars during the summer.
What could explain this difference : A curious student went around the math department and asked the professors how many tattoos they have when taken as a fraction of the total body surface area
What is the probability that the sample mean : If 38 racing cars are randomly selected, what is the probability that the sample mean would be greater than 104.4 gallons? Round your answer to four decimal
Implement the 8-connected component algorithms : You are to implement the 8-connected component algorithms as taught in class in Java and C++.
Confidence interval be wider : Without doing any computations, would an 80% confidence interval be wider, narrower, or about the same? Explain.
What is the margin of error : What is the margin of error for a 95% confidence and what are the upper limits and lower limits?
Probability that the proportion of vegetarians in a sample : If the statistician is correct, what is the probability that the proportion of vegetarians in a sample of 569 Americans would be greater than 9%?
Compute the estimated d and r2 to measure : A random sample of n=19 scores is obtained from a population with a mean of µ=80, and a treatment is administered to the sample.

Reviews

len2372632

9/19/2019 12:42:36 AM

The requirement for this homework3 Expect shill requirement: Expert should know both languages Java and C++ in professional. Expert also have experience in Computer Vision programming for image. This homework requires two languages: Java and C++. If an expert knows two languages of Java and C++, there is not big problem to transfer to C++ after finishing Java for the same homework.Finish Java for the homework first and then transfer to C++ for the homework.Do not re-write Java-Homework when use C++. Just transfer it. Java and C++ have the similar codes for Loop.

Write a Review

Data Structure & Algorithms Questions & Answers

  How we can prove different bounds for splaying

By changing the potential function, you can prove different bounds for splaying. Let the weight function W(i) be some function assigned to each node.

  Differences between the structured design methodology

differences between the structured design methodology

  Plot six training points in a two-dimensional space

how many examples do we need to exhaustively enumerate every possible combination of inputs -  what is the conditional probability that An item classified as Reject is actually good?

  What is the support and confidence of the rule

What is the support and confidence of the rule - What are the sales of suppliers from Madison to consumer in Toronto

  Write a driver program to test the recursive linear search

Write a driver program to test the recursive 1inear Search () function from Exercise.Write a recursive version of the linked-list-based linear search algorithm.

  Analyze the role cryptographic algorithms play

Analyze the role cryptographic algorithms play; you will go into depth on this topic in your first milestone assignment. How these algorithms could be utilized.

  Draw three spanning trees that can be found in the graph

Draw three spanning trees that can be found in the graph in Figure. Give the breadth-first traversal of the graph in Figure, starting from vertex A.

  I this assignment you will implement the compact

in this assignment you will implement the compact representation of the compressed suffix trie adt for dna analyses.a

  Find histories and terminal histories of the game

Find histories and terminal histories of the game - Find strategies of each player.

  Algorithm to concatenate string in single binary search tree

Create algorithm which concatenates T1 and T2 into single binary search tree. Worst case running time must be O(h).

  Define the type of graph known as a mesh of trees

Define the type of graph known as a mesh of trees. Explain how this graph is used in applications to very large system integration and parallel computing.

  Finding equation has no solutions mod m

Let the equation ax = b mod m, where x is unknown and a, b and m are given. Illustrate that this equation has either no solutions mod m, or d solutions mod m.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd