Question: Please complete the following C + + code section. Please note that this C + + file is only a function module that is called,

Please complete the following C++ code section. Please note that this C++ file is only a function module that is called, so there is no need for a main function.
Do not add or change the header file after #incluede
#include "includes_and_constants.h"
// Example function
void vertical_flip(const float image[][IMAGE_SIZE], float flipped_image[][IMAGE_SIZE]){
for (int i =0; i < IMAGE_SIZE; i++){
for (int j =0; j < IMAGE_SIZE; j++){
flipped_image[i][j]= image[IMAGE_SIZE -1- i][j];
};
};
}
// TODO1
void horizontal_flip(const float image[][IMAGE_SIZE], float flipped_image[][IMAGE_SIZE]){
//-------------------------------------------------------
// This function flips an 8x8 image horizontally.
//
// Inputs:
//- image: a 2D array of size 8x8, representing the pixel values of the image.
// Each element in the array corresponds to a pixel in the image.
//
// Outputs (via argument):
//- flipped_image: a 2D array of size 8x8. It is the result of horizontally
// flipping the input image.
//
// Example:
// If the input image is:
//00110000
//01111100
//01111110
//11100110
//01100110
//01100110
//00111110
//00111100
//
// then the result flipped_image should be:
//00001100
//00111110
//01111110
//01100111
//01100110
//01100110
//01111100
//00111100
//
//** Your TODO: Implement this function by looping through the flipped_image
// and assign them pixel values from corresponding position of the image array. **
}
// TODO2
void rotate(const float image[][IMAGE_SIZE], float flipped_image[][IMAGE_SIZE]){
//-------------------------------------------------------
// This function rotates an 8x8 image 90 degrees clockwise.
//
// Inputs:
//- image: a 2D array of size 8x8, representing the pixel values of the image.
// Each element in the array corresponds to a pixel in the image.
//
// Outputs (via argument):
//- flipped_image: a 2D array of size 8x8. This is the result of rotating
// an 8x8 image 90 degrees clockwise.
//
// Example:
// If the input image is:
//00110000
//01111100
//01111110
//11100110
//01100110
//01100110
//00111110
//00111100
//
// then the result flipped_image should be:
//00001000
//00111110
//11111111
//11000111
//11000110
//11111110
//01111100
//00000000
//
//** Your TODO: Implement this function by looping through the flipped_image
// and assign them pixel values from corresponding positions of the image array. **
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!