Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The only thing I have to code is that inside of each function that I'll write after the project description.. And moreover, the code after

The only thing I have to code is that inside of each function that I'll write after the project description.. And moreover, the code after that is main.cpp ( which is really long !!! and just use it as a reference) If you don't wanna read all of the main.cpp, and just doing 6 functions is fine !!

Anyone please help me to code those only 6 function to be work?

This is the only thing i need answer for Void prototype.Which i have below.

// Function Prototypes for the functions you must implement in project01.cpp void LoadImage(const string imagefile, int image[MAXROWS][MAXCOLS])

{

}

void FlipHorizontal(int image[MAXROWS][MAXCOLS]) void FlipVertical(int image[MAXROWS][MAXCOLS]) void RotateCW(int image[MAXROWS][MAXCOLS]) void RotateCCW(int image[MAXROWS][MAXCOLS]) void Transpose(int image[MAXROWS][MAXCOLS])

A fundamental software engineering skill is the design, implementation, and testing of a software component that may be integrated into a larger software product. In order to do this, the software component must conform to a previously agreed upon interface format. As part of this assignment, you will practice this skill by writing several functions that will be integrated into a larger software product provided by the instructor. Along the way you will review basic C++ programming skills required for successful completion of CPE 212.

For this project, you will complete the provided partial C++ program by implementing six functions that perform simple image processing operations on images stored as 10x10, two dimensional arrays of integers. The image processing operations are: (1) Load Image (2) Horizontal Flip (3) Vertical Flip (4) Transpose (5) Rotate 90 Clockwise (6) Rotate 90 Counter Clockwise You must implement each of these operations as a C++ function. Your code for the six functions above must appear in the file named project01.cpp in order to compile correctly.

Remember, spelling and capitalization count in Linux/C++. The function main() has already been implemented for you to provide a common way for everyone to test their code. The function main() will scan a sample input file and perform the requested series of image processing operations by invoking your functions as needed. Prototypes for the six functions are already provided for you in main.cpp (do not modify main.cpp !!!). All program output is performed by the code in the main.cpp file do not include any output statements in the file project01.cpp The interfaces to each of these functions you must write are described in detail on subsequent pages and in the prototypes listed within main.cpp

void LoadImage(const string imagefile, int image[MAXROWS][MAXCOLS]); // LoadImage() must open the image file for input and load the image into a // two-dimensional array for subsequent processing. Assume that the file will open. // Parameter imagefile is a string that will hold the name of the image file to load. // Parameter image is a two-dimensional array of integers representing the image // loaded from the file // Note: Correct operation of this function is critical!! If one cannot correctly // load images into the array from the file, then one cannot test the // image processing operations and your code will fail every test!

void FlipHorizontal(int image[MAXROWS][MAXCOLS]); // FlipHorizontal() - must flip the image horizontally. For example, // column zero exchanged with column N-1, column one exchanged with column N-2, etc. // Parameter image is a two-dimensional array of integers representing the image

void FlipVertical(int image[MAXROWS][MAXCOLS]); // FlipVertical() - must flip the image Vertically. For example, // row zero exchanged with row N-1, row one exchanged with row N-2, etc. // Parameter image is a two-dimensional array of integers representing the image

void RotateCW(int image[MAXROWS][MAXCOLS]); // RotateCW() - must rotate the image 90 degrees clockwise. // Parameter image is a two-dimensional array of integers representing the image

void RotateCCW(int image[MAXROWS][MAXCOLS]); // RotateCCW() - must rotate the image 90 degrees counter clockwise. // Parameter image is a two-dimensional array of integers representing the image

void Transpose(int image[MAXROWS][MAXCOLS]); // Transpose() - must flip the image across the primary diagonal row = column as // with a matrix transpose // Parameter image is a two-dimensional array of integers representing the image

The code of main.cpp is here. if you don't wanna see all of this you can just do the 6 functions above. Please help me out !!!!

// // main.cpp -- Project01, CPE212 Fall 2010 -- C++ Review Project // // Driver program for Image Processing Program which is used to test each // image processing operation. // // DO NOT SUBMIT OR SUBMIT THIS FILE // // List of allowed include files appear below #include #include #include using namespace std; // Global using declaration // Global Constants -- you may use these global constants in your code const int MAXROWS = 10; // Maximum number of rows in image const int MAXCOLS = 10; // Maximum number of columns in image // Function Prototypes for functions included at the end of main.cpp void Print(const int image[MAXROWS][MAXCOLS]); void Bars(); // Function Prototypes for the functions you must implement in project01.cpp void LoadImage(const string imagefile, int image[MAXROWS][MAXCOLS]); void FlipHorizontal(int image[MAXROWS][MAXCOLS]); void FlipVertical(int image[MAXROWS][MAXCOLS]); void RotateCW(int image[MAXROWS][MAXCOLS]); void RotateCCW(int image[MAXROWS][MAXCOLS]); void Transpose(int image[MAXROWS][MAXCOLS]); // Start of main() function int main (int argc, char * const argv[]) // Command-line arguments (more on this later) { ifstream inputs; // Input file stream variable for test file char op, ch; // Hold operation and optional char input from test file string comment; // Holds comment string input from test file int image[MAXROWS][MAXCOLS]; // Array of integers representing image string imagefile; // Name of image file // Output usage message if test input file name is not provided if (argc != 2) { cout << "Usage: project01 "; return 1; } // Attempt to open test input file -- terminate if file does not open inputs.open(argv[1]); if (!inputs) { cout << "Error - unable to open input file" << endl; return 1; } // Process comment line from input file getline(inputs, comment); // Input file header comment cout << endl << comment << endl << endl; // Output file header comment // Below is primary loop that processes each operation appearing within the test file. // Starts with an initial priming read of first operation inputs >> op; // Attempt to input first test operation from file while (inputs) // While Not-EOF { switch (op) // Process operation input from test file { case '#': // Test file comment getline(inputs, comment); // Input and echo the comment appearing in the test file cout << '#' << comment << endl; break; case 'p': // Print Grid Print(image); // Function definition appears at the end of this file break; case 'b': // Print Bars Bars(); // Function definition appears at the end of this file break; case 'i': // Load Image inputs >> imagefile; // Input name of imagefile from test file LoadImage(imagefile, image); // Implement this function in project01.cpp break; case '+': // Rotate Image Clockwise 90 Degrees RotateCW(image); // Implement this function in project01.cpp break; case '-': // Rotate Image Counterclockwise 90 Degrees RotateCCW(image); // Implement this function in project01.cpp break; case 'v': // Flip Image Vertical FlipVertical(image); // Implement this function in project01.cpp break; case 'h': // Flip Image Horizontal FlipHorizontal(image); // Implement this function in project01.cpp break; case 't': // Transpose Image Across Major Diagonal Transpose(image); // Implement this function in project01.cpp break; default: // Error cout << "Error - unrecognized operation '" << op << "'" << endl; cout << "Terminating now..." << endl; return 1; break; } cout << endl; inputs >> op; // Attempt to input next command } return 0; } /************** Implementation of Print() and Bars() functions ********************/ // DO NOT MODIFY THIS CODE void Print(const int image[MAXROWS][MAXCOLS]) // Print() -- outputs image row-by-row in desired format substituting // * for 1 and - for 0. { for(int r=0; r < MAXROWS; r++) // Loop to visit each row in image { for(int c=0; c < MAXCOLS; c++) // Loop to output every element on current row { if (image[r][c] == 1) // Output appropriate symbol { cout << '*'; } else if (image[r][c] == 0) { cout << '-'; } else { cout << 'X'; } } cout << endl; } } // End Print() void Bars() // Bars() -- prints two horizontal rows of bars { cout << "#################################################################" << endl; cout << "#################################################################" << endl; } // End Bars() /************** DO NOT DELETE *************/ // The preprocessor directive below will import the function definitions // from the file project01.cpp and place them at the end of this file creating an // Expanded Source File which is forwarded to the compiler for compilation. #include "project01.cpp" /************** End of main.cpp ***************/

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions