Write a processing program to simulate a indexed imaging

Assignment Help Computer Engineering
Reference no: EM131912579

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.

Reference no: EM131912579

Questions Cloud

What amount of cash disbursement for rent would be reported : What amount of cash disbursement for rent would be reported in Company's net cash flows from operating activities for 2014 presented on a DIRECT BASIS
Free cash flow information on potential investment project : Suppose you have the following initial outlay and free cash flow information on a potential investment project
What was the income before extraordinary items : Company reported the following results from operations for 2014: income tax rate....40%. What was the income before extraordinary items
Calculate the total number of cavities submitted for patient : Some dental offices may not employ real dentists and may be front companies that are sending claims out for work not performed.
Write a processing program to simulate a indexed imaging : 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.
Terrestrial planets in the inner solar system : Name and describe at least 3 ways in which the EARLY EARTH (and the other "Terrestrial" planets in the inner solar system; Mercury, Venus
Atomic and ionic properties : How would you expect the solubility of silver fluoride (AgF) to compare to the halides measured in lab (AgBr, AgCl, AgI)?
Why is java called platform independent programming language : What is JVM? Why is Java called the ‘Platform Independent Programming Language'?
What volume of gaseous product will be generated at stp : If 592.6 g of TATP is combusted in excess oxygen, what volume of gaseous product will be generated at STP.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Create the definition of the function

Write down the definition of the function template moveNthFront that takes as a parameter a queue and a positive integer, n. The function moves the nth element of the queue to the front.

  Why proper information is placed for each person

They are placed in A2-F2. My problem is that I have no idea how to change this information to apply to all the other friends (the current formula repeats friend 1's information for all the others). For instance , friend 2's information involves Ar..

  Write an armv-eight program to sort an array of elements

Write and test an ARMv8 program to sort an array of elements. As I mentioned in class, this problem uses a portion of your Programming Assignment.

  Supply getmethods and setmethods for each variable

offer getmethods and setmethods for each variable. This constructor then sets the class variables miles and gas to the respective input parameters, inputmiles and inputgas.

  Why is it difficult to conduct a qualitative risk assessment

Why is it difficult to conduct a qualitative risk assessment for an IT infrastructure?

  Explain how you might design the hardware and software

We described how the operating system kernel mediates access to I/O devices for safety. Some newer I/O devices are virtualizable - they permit safe access.

  Draw a block diagram of the ic showing all input and outputs

Draw a block diagram of the IC showing all inputs and outputs. Include two pins for the power supply. Draw a block diagram using two ICs to produce an 8-bit bidirectional shift register with parallel load.

  How you would delete element from multiway radix search tree

Describe how you would delete an element from a multi-way radix search tree. Find a set of 12 keys that make a particularly badly balanced Patricia tree.

  Create the logic for a game that simulates rolling two dice

Create the logic for a game that simulates rolling two dice by generating two numbers between 1 and 6 inclusive. The player chooses a number between 2 and 12.

  Describe an implementation of the methods of a binary tree

Describe an implementation of the methods of a binary tree with this data structure and analyze the time complexity for these methods.

  Write down an assembly language program

Write down an assembly language program The product number from one to five (3 characters wide, right justified)

  What is the default size of a text controls text box

What is the default size of a text control's text box? What is the difference between the size and maxlength attributes of input for text controls?

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