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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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