Create a new image from the process in 2 that will consist


Programming Assignment: Image Processing - Pointers, Class & Dynamic Data

This project is called "Image Processing" which will shrink an input image, convert a color image to gray image , add random noise to an image, add the RGB va lues of an image , or (as bonus) to denoise the image.

But before we rush into this programming challenge, it is important to be intentiona l about some basic design considerations and a few techniques for managing and manipulating digital images. In solving this problem we will be using classes, pointers, and structured data in order to organize an efficient solution. The images you will manipulate are two dimensional images with a width and a height in units of pixe ls. Think of an image as a 2D array, indexed by rows (horizonta l "scan lines"), which go across the image, and columns (vertical stripes through the image). Any pixel in an image is located by its (row, col) coordinates, or in C++ array terms, myImage [row][col]. Stored at each position in this two dimensional structure are the details of an individua l pixel, represented as a point in a 24-bit RGB color space (8 bits for red, 8 bits for green, and 8 bits for blue). This is a common way to store image data, and is straightforward to understand. In this case, each and every pixe l in the image consists of three values that are each 8 bits in length. This 8 bit size is no accident (we can store 8 bits in one unsigned char variable). These three values represent the red, green, and blue components of a single pixe l. Since the value has 8 bits, it can hold any va lue between 0 and 255. A pixel with red, green, and blue all zero will appear black; a pixe l with R, G, and B all equa l to 255 will appear white. Or put another way, a low value is "dark" and a high value is "bright". Just like an array, the origin (pixe l at 0, 0) is normally viewed by convention as the upper left pixel, with rows horizonta l and columns vertical. So first, make sure you understand the structure of an image: a 2D array (with a width, he ight); scanlines as rows; a coordinate frame that has the origin in the upper left, with positive x along the horizonta l from left to right, and positive y along the vertical from top to bottom; and at each location a composite pixel object which contains values for R,G,B - and each of those will require 8 bits. The structure/layout has a very natural visual interpretation.

In this project, we will work on how to find the average color in a larger block of pixels can be thought of as a very simple re-sampling of the bigger image. This technique is often used to generate smaller versions of big images. (think of a thumbnail of the original image). In this assignment we will be writing a program that can:

1.) Allow simple loading and saving of images.
2.) Break a loaded image up into blocks of a given width and height and find the average color in that block.
3.) Create a new image from the process in (2) that will consist of 1 pixel per every block analyzed in the first image.
4.) Apply a red, green, or blue tint to an image by increasing the appropriate RGB values to every pixel in the image.
5.) Randomly add noise pixels into an image.
6.) As bonus function, to denoise the image with noise.

Provided in the code base for this assignment, you will see the following files in addition to the usual:

globals.h

Per usual, you can turn on a console to output debugging information to by modifying the SHOW_DEBUG_CONSOLE variable. You should also note in the file that the type "unsigned char" has a typedef to the easier to write, "uchar". These types are interchangeable throughout the program.

pixe l.h

This file contains the "pixel" class that is used to store the red, green, and blue values for a pixel of data. Note: that the pixel class consists of 3 public uchars to store this data. The implementation of this class with it's data members public is an example of a POD (Plain Old Data) Class. In almost all cases, you want to keep your data members private and provide getters and setters to access them. However, in some cases (such as this) we require no functions whatsoever (no constructors or any member functions) and just want to aggregate several pieces of data into one object. In these cases, it is considered acceptable to just have the data members public ly accessible, as it allows for a smaller memory footprint and easier notation when referencing the data.

image .h / image .cpp

This class is provided to do the grunt work of loading and saving the images. It also provides a way for the windows GUI to display the images represented in our RGB pixel data. The functions you should be concerned with are:
bool loadImage (string filename )

This function will load an image from the specified file and return true if it loaded successfully, fa lse if it did not.

void saveImage(string filename )

This function will attempt to save the picture stored in it's pixel data to disk at the specified file location.

void create NewImage(int width, int he ight)

This function will clear all current data in the image object and create a new blank image of the specified width and height. You should call this or loadImage BEFORE you try to access the pixels of an image.

int getWidth()

This function returns the number of pixels wide that the image is.

int getHeight()

This function returns the number of pixels tall that the image is.

pixe l** getPixels()

A multidimensional array of pixel objects makes up any of our images. However, because we don't know the size of the image beforehand, this multidimensional array is created dynamically at run time. Feel free to look at the image.cpp code to see how this is done.

This function will return that multidimensiona l array. Note the return type of pixe l**. Remember that an array is essentially a pointer to the first value of the array block in memory. So pixe l[ ] is equivalent to pixel*. After understanding this, it is a logical jump that a 2 dimensiona l array is actually a pointer to a pointer. Therefore, when calling this function, you should write something like:

pixel** myPixels = myImage .getPixels();

You can then reference the elements of the array normally. Ex:

myPixe ls[0][0].red = 255;

This would set the red value of the first pixe l in the image to its max value. You should utilize these objects as you see fit to implement the specifications for this program. Supplied for you is a GUI interface written in Visual C++.

Attachment:- Image Processing.rar

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Create a new image from the process in 2 that will consist
Reference No:- TGS01723428

Expected delivery within 24 Hours