Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment: Color Indexing and Dithering

Write a Processing program to simulate a indexed imaging and implement Floyd-Steinberg dithering. Set the number of colors in a variable or constant defined near the top of the program; your program should be able to handle 8 to 256 colors. The setup() function loads an image (with the filename defined by a String variable near the top of the program), reads a color palette (determined by the image filename and the number of colors), and calls your functions to create a new image that uses only colors from the palette and then a second image that uses Floyd-Steinberg dithering to reduce artefacts introduced by indexing. Test your program with the following images: ColoredSquares.jpg, colorful-1560.jpg, and Lizard.jpg.

Hot keys are set up as follows: ‘1' displays the original image (img[0]), ‘2' displays the indexed image (img[1]), ‘3' displays the dithered image (img[2]), ‘c' displays the color palette, ‘h' displays the histogram of the indexed image (phist), and ‘d' displays the histogram of the dithered image (dhist). If you prefer, the two histograms may be displayed as text in the display window (not the console). NOTE: ‘h' and ‘d' do not display the histogram of the original image-rather, for each entry in the color palette, they display the number of times that color is used; for example, if palette[0] is used 10 times, then counts[0] = 10. Display the color palette as a grid filled with the corresponding color in the table; you cannot simply display the palette image stored in palettes.

When dithering, you will have to handle the boundary problem-the first pixel in a row has no lower left neighbor; the last pixel in a row has no right or lower right neighbor; the bottom row has no lower neighbors. A common solution is to leave a one pixel border on the left, right, and bottom that is not dithered.

There are at least two implementations of Floyd-Steinberg dithering, in Processing, on the Internet. One of them is very similar to my implementation. In fact, this is a reasonably generic algorithm and I would be hard-pressed to determine whether you copied Internet code or wrote your own. So I won't try - you are free to use the Internet implementation of the dithering - and only the dithering - algorithm. But you must make it work within the framework of the code I have given you - and be sure it's the Floyd-Steinberg algorithm and not a different one. In the end, you might find it easier to write your own.

Indexing pixels

For each pixel

Find the closest palette color //Use Euclidean distance

Replace the pixel with the palette color

If dithering

Add quantization error to neighboring pixels, as specified by the Floyd-Steinberg algorithm.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92751243

Have any Question?


Related Questions in Computer Engineering

Margaret moore wants to invest in four-year bonds that are

Margaret Moore wants to invest in four-year bonds that are currently priced at $863.49. These bonds have a coupon rate of 5.1 percent and make semiannual coupon payments. What is the current market yield on this bond? (R ...

The researchers stated that there were no significant

The researchers stated that there were no significant differences in the baseline characteristics of the intervention and control groups. Are these groups heterogeneous or homogeneous at the beginning of the study? Why i ...

Wanda is placing dog biscuits in her bed to save them for

Wanda is placing dog biscuits in her bed (to save them for later). How many patterns can she create if she has 6 beef biscuits, 8 chicken biscuits, and 3 bacon biscuits, assuming she must place all 10 biscuits?

The average cell phone bill is 78 with a standard deviation

The average cell phone bill is 78 with a standard deviation of 10. What is the minimum percentage of cell phone bills that will be between 54 and 102?

A bird is flying around the world at a rate of 256ftmin how

A bird is flying around the world at a rate of 25.6ft/min. How many weeks will it take to compete it's journey if the circumference of the earth is25,000 miles using factor label method.

Explain how the following industries should adapt their

Explain how the following industries should adapt their businesses to the ever expanding use of social networks and mobile computing (smart phones, tablet computers, etc.): 1) Media and Entertainment, 2) Department store ...

Question suppose your system is designed in such a way that

Question : Suppose your system is designed in such a way that your computer needs to wait for some while to check if the channel is clear before transmitting. You take your measurement overtime and you come to find out t ...

Discuss how the scope of computer security grew from

Discuss how the scope of computer security grew from physical security to include : Securing the data Limiting random and unauthorized access to that data. Involvement of personnel from multiple levels of the organizatio ...

Junit test labyou will be creating a junit test class for

JUnit Test Lab You will be creating a JUnit Test Class for Gradebook.java, that has been provided for you.   Add a getScoreSize() method to the Gradebook class which returns scoresSize; Add a toString() method to the Gra ...

Youre trying to save to buy a new 190000 bmw 3 series

You're trying to save to buy a new $190,000 BMW 3 series sedan. You have $40,000 today that can be invested t your bank. The bank pays 4.8% annual interest on its accounts.  How long will it be before you have enough to ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As