Create a processing program to simulate a indexed imaging

Assignment Help Computer Engineering
Reference no: EM131918999

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

Reference no: EM131918999

Questions Cloud

True mean point-spread error : Use this information to test the hypothesis that the true mean point-spread error for all NFL games is positive. Conduct the test at a = .10 and interpret
Make a histogram of the data for production : The injection-molded caps of disposable ballpoint pens must meet tight specifications to fit snugly on the pen. One specification that is tracked is the cap's.
Exchange rate problem : Deluxe Corporation is a large chain of retail stores operating in the USA. The proposed project is to be evaluated over a three-year time horizon.
Choose a random sample to test hypothesis : Not using a random sample How could you choose a random sample to test this hypothesis?
Create a processing program to simulate a indexed imaging : Assignment: Color Indexing and Dithering- Create a Processing program to simulate a indexed imaging and implement Floyd-Steinberg dithering.
Biggest employment challenge : Construct a 95?% confidence interval for the population proportion of nonprofits that indicate turnover as the biggest employment challenge
What is the present value of the expected cds payout : Default intensities are 5%, and 12% in years 1 and 2. The discount rate is 5%. What is the present value of the expected CDS payout?
Create a check sheet to organize and analyze the data : In an apparel factory, every time a sewing machine breaks, the symptom is recorded. In the past 30 days, all of the sewing machine breakdowns were recorded.
Evidence to support the union claim : Assume the population is normally distributed. At ???? = .01, is there enough evidence to support the union's claim?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Show an appropriate message regarding the bonus

show an appropriate message regarding the bonus when the QuarterlySales for the SalesPerson falls within these ranges.

  Write a java class that can take any red-black tree

Write a Java class that can take any red-black tree and convert it into its corresponding (2,4) tree and can take any (2,4) tree and convert it.

  Use the int cast process to convert to an integer

give Output the corresponding letter grade along with the initial number entered in decimal format utilizing the printf method and format specifiers. Output the number in only 3 decimal places.

  Write down the decimal equivalents for ieee floating point

Add the unsigned binary numbers then express the answer in decimal.

  Your responsibilities for the server deployment begins at

bluesky systems is a software development company that builds software components for a variety of private and

  From the code of ethics reading, focus on section one

General Moral Imperatives. How do these affect you as a student. How will they affect you as you move into the professional workplace

  How should the systems analyst deal with the cocky inovice

How should the systems analyst deal with the cocky Inovice' described in this chapter? What if the user insists on a particular choice of computer hardware?

  How bandwidth affects the average consumer of technology

This solution provides the learner with an understanding on why it is important to understand the bandwidth needs for wide area networks. Further, this answer provides a dicussion on how bandwidth affects the average consumer of technology.

  Determine what the command or function sqrt

What MATLAB function should be used to determine what the command/function sqrt does? A for loop is required to print out the elements of a structure in C

  Determine which company the customer could buy each item

Design a polynomial time algorithm to determine which company the customer could buy each item from to minimize her total cost.

  Craete an inheritance hierarchy for classes quadrilateral

Write down an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy.

  Write a program to compare how long it takes to sort a list

Write a program to compare how long it takes to sort a list, using various sorting methods. Create a 3x3 element 2D results arrays that will hold the time.

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