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.

Deliverables

Processing program, described above

Be sure your program is well documented internally.

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.

Attachment:- Assignment.zip

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Question a small financial focused business is looking to

Question : A small, financial focused business is looking to organize and secure its network. It currently has a single public IP address from a local telecom. Construct an argument as to how you think a company should e ...

Why regulated industries should be required to follow

Why regulated industries should be required to follow security standards. Provide 2 examples of industries that would fall under this category.

You are studying the number of defective parts produced

You are studying the number of defective parts produced each week by several machines to help adjust maintenance protocols. Assume the rows of matrix Def represent different machines and all columns except the last repre ...

Question interface design guidelines please respond to the

Question: "Interface Design Guidelines" Please respond to the following: • Imagine you are leading a team of designers for a new software product. During the kickoff meeting, the team starts to discuss design guidelines. ...

Smartphones have become an important part daily life

Smartphones have become an important part daily life, including how we communicate in business. Mobile device security is emerging as one of top targets for cybercriminals. Using Microsoft Word, write a 400 word paper us ...

Question the states of california arizona new mexico utah

Question : The States of California, Arizona, New Mexico, Utah, and Nevada each send a team of 6 delegates to the Sounth Western States annual conference. A sub commitee of 9 is to be formed to discuss water rights. How ...

Hoping to lore more shoppers downtown he said he built a

Hoping to lore more shoppers downtown. He said he built a new public parking garage in central business district. The city plans to pay for the structure through parking fees. For a random sample of 44 weekdays, daily fe ...

When i have a class that extends application public class

When I have a class that extends Application (public class Game extends Application) I can easily call it from my driver class by typing launch(Game.class). Now I have two other classes where one extends JFrame and the o ...

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Suppose a 4 packets of a message each of size 10 mbit

Suppose a 4 packets of a message, each of size 10 Mbit arrive simultaneously at a switch preceding a transmission link of rate 5 Mbps connecting to the destination host. (a) What is the average queuing delay experienced ...

  • 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