Create new image from process that will consist of one pixel

Assignment Help C/C++ Programming
Reference no: EM131320774

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

Reference no: EM131320774

Questions Cloud

Rois-kpis and web analytics : Recommend at least one (1) way a business with which you are familiar could use social media / buzz marketing to increase sales and awareness (e.g., social media awareness) of your products. Give your opinion on what a business needs to know about..
What is the connection to modernism and post-modernism : What is the connection to modernism and post-modernism in Chicana/o Art? P1rovide two examples of Chicana/o Art (include title of work and name of the artist and the year created) and discuss your reasoning in arriving at your conclusions regarding..
Improve on the simple interrupted time series design : Discuss how the interrupted time series design with a reversal and the interrupted time series design with multiple replications improve on the simple interrupted time series design.
How many valence electrons are enclosed in the bohr sphere : How many valence electrons are enclosed in the Bohr sphere or in the spherical volume enclosed by the trapped electron orbit? Is the assumption on the static dielectric constant reasonable and why?
Create new image from process that will consist of one pixel : Create a new image from the process in (2) that will consist of 1 pixel per every block analyzed in the first image. Apply a red, green, or blue tint to an image by increasing the appropriate RGB values to every pixel in the image.
What is orbit radius of an electron trapped at ground state : What is the orbit radius of an electron trapped at the ground state? How many valence electrons are enclosed in the Bohr sphere or in the spherical volume enclosed by the trapped electron orbit?
Communicating with others proactively : 1. For this Forum, you need to read Part III "Communicating with Others Proactively" in your textbook. 2. Discuss the key elements of positive and proactive communications that are missing in the following workplace scenarios and any other aspects ..
What is estimated cost of common equity : Booher Book Stores has a beta of 1.2. The yield on a 3-month T-bill is 3.5% and the yield on a 10-year T-bond is 6%. The market risk premium is 5%, and the return on an average stock in the market last year was 15%. What is the estimated cost of comm..
How long will it take you to pay off this debt assuming : Today, you borrowed $1100 on your credit card to purchase some furniture. The interest rate is 24 percent, compounded monthly. How long will it take you to pay off this debt assuming that you do not charge anything else and make regular monthly payme..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c program that will read the required values

Write a C program that will read the required values from the input file, compute the hole to depth ration, the ideal number of sticks, the ideal powder charge, the actual powder charge, and the actual number of sticks.

  Authentication method for android

For the fourth program under Connector for Pi to be able to (Connect between File Handle and Client+Server socket program).

  Make a function in dr racket

Make a function in Dr Racket that consumes a string and figures out if it starts with a specific letter of the alphabet - Can you help me how should I go about this? Please any ideas?

  Odd clusters using c programming

The objective of this project is to write an interactive Odd Clusters game, using the programming knowledge you have gained this semester. Your task is to write a programthat allows one player to play a game of Odd Clusters against the computer o..

  Geometric calculations

In this homework assignment, you will be writing an area calculator to understand console input/output, some basic data types, and basic arithmetic in C++.

  Convert code of python in c

Hello , I have a code in python and I need to convert it in C. If you are an expert contcat with me.

  Implement a program for displays a maze of ascii symbols

Design and implement a C++ program for displays a maze of ASCII symbols on the screen and perform simple calculations.

  The process function will then need

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait tim..

  Write a program in c which accepts 4 number

Write a program in C which accepts 4 numbers  from the user and stores them in an array. Using the pointer mathematics it traverses the array and get the sub of all the elements. Use only one pointer variable

  Write mergesort code for data instead of as array

Write mergesort code for data instead of as array - which takes a linked list of integers, as in the bubblesort example code. The decclaration of the struct listnode is the same as in the bubblesort on lists example.

  Prepare a program that uses the pthread library

Prepare a C/C++ program that uses the PTHREAD library to create threads and mutexes to synchronize them.

  Maturity amount after the period of deposit

Develop a program that accepts a deposit amount and period of deposit. Calculate the maturity amount after the period of deposit. The bank pays 4% interest per year for any deposits made in the bank.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd