Question
Using C please help implement this.The shell program to use for this is posted below. This is the shell program needed to work through the
Using C please help implement this.The shell program to use for this is posted below.
This is the shell program needed to work through the problem:
#include
#include
/*
Student Name:
Date:9/6/17
Homework 1-2
This is the only file that should be modified for the C implementation
of Homework 1.
This program computes the similarity count for the two arrays Patch1
and Patch2 and prints it out.
The similarity count is the number of times each pair of corresponding
pixels in the two arrays is within an epsilon (5) of each other.
FOR FULL CREDIT, BE SURE TO TRY MULTIPLE TEST CASES and DOCUMENT YOUR CODE.
*/
//DO NOT change the following declaration (you may change the initial value).
unsigned Patch1[] = {1, 14, 9, 10, 11, 6, 56, 60, 78, 100, 4, 5, 0, 3, 5, 9} ;
unsigned Patch2[] = {1, 18, 7, 16, 12, 1, 68, 49, 70, 826, 2, 9, 9, 9, 9, 9} ;
unsigned Similarity;
/*
For the grading scripts to run correctly, the above declarations
must be the first lines of code in this file (for this homework
assignment only). Under penalty of grade point loss, do not change
these line, except to replace the initial values while you are testing
your code.
Also, do not include any additional libraries.
*/
int main() {
Similarity = 0; // temporary initial value for shell (replace this)
// Your program should use this print statement.
// Do not change the format!
printf("%d is the similarity count. ", Similarity);
return 0;
}
The shell program has two integer arrays declared and initialized as the global variables Patchl and Patch2. Each array contains 16 unsigned integers, representing a set of pixel values in a region of an image. Your program will compute the following measure of how similar the two regions are: compare each pair of corresponding pixels (i.e., for each index i, compare Patch! [i] to Patch2 [i]) and count the number of times they are within an epsilon = 5 of each other (i.e., their difference is less than 5). Your program should print out the similarity count (Similarity) using the print statement in the shell code. Be sure to try multiple test cases, but do not change the declaration of the global variables (you should change only their initial values, such as the pixel values in the two arrays to create new test cases). ECE 2035 Homework 1 Fall 2017 Example Patch![] = Patch! [ ] = Similarity {1, 14, 9, 10, 11, 6, 56, 60, 78, 100, {1, 18, 7, 16, 12, 1, 68, 49, 70, 826, = 1+1+1+0+1+0+0+0+0+0+1+1+0+0+1+1-8 9} 9} 4, 5, 0, 3, 5, 2, 9, 9, 9, 9Step 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