Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming Problem I haven't been able to get any help on this question so any help is appreciated. Basically, the user will input an

C++ Programming Problem

I haven't been able to get any help on this question so any help is appreciated. Basically, the user will input an image in which the pixels are scrambled around. Using the size of the image (horizontally and vertically) an algorithm given can be used to unscramble the image and reveal it. I am completely lost and any help is appreciated. The details are posted below:

Program Input Enter image name:

The user will always enter a png image with the phrase Puzzle.png at the end. The images will be square with an even number of rows and columns.

Program Outputs Corrected image saved to XXX

Replace the word Puzzle with Fixed in the original name, saving the new image to file Assignment Details

A digital image is essentially a multidimensional collection of pixels, which are the smallest components of the image. Think of an image as a closely-packed grid of dots that each have their own color, represented using the RGB format: Red-Green-Blue. By combining thousands or millions of these pixels, we can create rich digital images! Your goal for this assignment is to solve different image puzzles by implementing a pixel decoding algorithm. For each puzzle, a real image was taken and the pixels scrambled to hide the true image.

Sample Output

After applying the pixel decoding algorithm, you should get a recognizable image back (Note that the colors of the image will no longer be perfect due to the algorithm).

Test Case 1:

Enter image name: Alpha_Puzzle.png Corrected image saved to Alpha_Fixed.png 

Test Case 2:

Enter image name: Bravo_Puzzle.png Corrected image saved to Bravo_Fixed.png 

Test Case 3:

Enter image name: Charlie_Puzzle.png Corrected image saved to Charlie_Fixed.png 

Pixel Decoding Algorithm

Use the following steps to solve the puzzle:

Create a blank image of the same size as the image puzzle Go to every row and column location in the image and do the following:

Move pixels from the image puzzle to a new row and column location in the blank image:

If at an odd row index, use the formula: new row = (row 1)/2

If at an even row index, use the formula: new row = row/2 + (image height)/2

If at an a col in the left half, use the formula: new col = (image width)/21col

If at an a col in the right half, use the formula: new col = 3(image width)/2 1col

Fix the colors in the image: Multiply all the red and blue pixel values by 3

Set all the green pixel values to 0 Rearrange the image:

The image has been split into 4 quadrants based on the two diagonals through the middle of the image

Fix the quadrants by swapping the top and bottom quadrants Save the fixed image to a file where the word Puzzle has been replaced by Fixed

Useful image commands

Feel free to use the following image commands to help with the homework! Check any online C++ help or the class notes for more information on using each command:

#include png.hpp - new header for access to image information using namespace png; - new namespace for access to image functions/routines imagergb pixel - data type for color images .get width() - returns the width of the image .get height() - returns the height of the image .write() - saves your image to your computer in the Debug folder values

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

Students also viewed these Databases questions

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago