Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA QUestion ( this is all the requisition ) Do not create one mega-size main class. Do not modify existing methods of Image class. Feel

JAVA QUestion ( this is all the requisition )

Do not create one mega-size main class.

Do not modify existing methods of Image class.

Feel free to extend Image class.

You might want to add instance variables and methods to given classes, create subclasses, or add new classes.

Test your program with all test data.

Display the following main menu to the user and receive the users input.

Main Menu-----------------------------------

1. Conversion to Gray-scale Image (24bits->8bits)

2. Conversion to N-level Image

3. Conversion to 8bit Indexed Color Image using Uniform Color Quantization (24bits->8bits)

4. Conversion to 8bit Indexed Color Image using [your selected method] (24bits->8bits)

5. Quit

Please enter the task number [1-5]:

After performing the selected task, go back to display the menu again.

Task 1 - Conversion a 24-bit Color to a 8-bit Gray-scale (10 pts)

Read the 24bit input PPM image. Convert 24-bit color pixels to gray-scale pixels. Use the following equation to compute the gray-scale value from R(Red), G(Green), and B(Blue) of each pixel.

Gray = round(0.299 * R + 0.587 * G + 0.114 * B)

After the computation, make sure that Gray is an integer ranging 0-255. Truncate if it is not in the range. Display the output and save it into a PPM file.

Task 2 - Conversion a 24-bit Color to a N-level (50 pts) Read the 24bit input PPM color image. Convert 24-bit color pixels to N-level pixels. For example, if N=2, it is to convert the input to a bi-level image (i.e. quantize the gray scale value into one of two values, 0 or 255). If N=4, it is to convert the input to quad-level images (i.e. quantize the gray scale value into one of four values, 0, 85, 170 or 255).

Steps:

a. Convert a 24-bit color image into a gray-scale image using the method in Task1.

b. Receive a value for N from the user. Assume that the user will enter 2 (1bit), 4 (2bits), 8 (3bits), or 16 (4 bits) for N.

c. Display and save two output images: o Output1: N-level image produced by the threshold method. For example, if N=2, use a threshold value (such as 128) to determine to quantize each gray scale value into 0 or 255. o Output2: N-level image produced by the error diffusion method.

3. Task 3 - Uniform Color Quantization (40 pts)

Read the 24bit color image. Quantize 24bit colors to 8bit colors using the Uniform Color Quantization method.

Step1: Generate the 8-bit color Look Up Table (LUT) by the Uniform Color Quantization and display the table to the console as shown below.

image text in transcribed

Step2: Convert each 24-bit pixel of the input image into an 8-bit index value. Save the 8-bit color index values into [InputFileName]-index.ppm file. Assign the same index values to R, G, and B.

Step3: Save and display the 8-bit indexed-color image. To do this, you have to retrieve (or get) RGB values from the lookup table (LUT) using the index value of each pixel. Do not overwrite the original input in order to save your output. Save your output into a new image (named [InputFileName]-QT8.ppm).

Index R G B 2 16 16 32 16 16 96 16 16 160 16 48 96 255 Index R G B 2 16 16 32 16 16 96 16 16 160 16 48 96 255

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions

Question

Simplify the given expressions. d 3 3 dx - dx dt

Answered: 1 week ago