A bitmap image is a matrix of pixels
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

A bitmap image is a matrix of pixels

Question 2. Bitmap Image Processing

A bitmap image is a matrix of pixels. Each pixel holds a color value, which can be coded with the RGB (Red, Green, Blue) convention: a color value is a vector -->c = (r, g, b) where r, g and b are real numbers between 0 and 1. Equivalently, we can see the bitmap image as a triple (R; G; B), where R, G, B are three matrices containing the red, green and blue values respectively. The following example shows both representations of a 3 × 2 pixels bitmap image.


In this exercise, we test matrix operations on those colorful matrices.

(a) Choose a nice colorful photo (or use the classical one provided with the assignment) in PNG format and import it in Sage by executing the provided pieces of code. This will give you three matrices R, G and B as described above. Show your picture with the provided rgbplot function (which you can reuse in the next parts).

(b) Grayscale colors are the RGB triples of the form (x, x, x). We can therefore turn any picture into grayscale by calculating a weighted average x of the three colors on each pixel. A good average you may use is: x = 0.3r + 0.59g + 0.11b. Convert your picture to grayscale and show it with rgbplot.

(c) Given a color (r; g; b), its inverse color is the RGB triple (1 − r, 1 − g, 1 − b). Invert the colors of your picture and show the resulting inverted picture. (d) Calculate the transpose of your image and show it. What geometric transformation does this represent?

(e) A horizontal flip of a bitmap picture is a reflection of the picture about a vertical axis located in the center of the picture. Calculate the horizontal flip of your picture and show it.

(f) Rotate your picture by 90◦ counterclockwise, and show the result.

Hint
MathematicsMatrix is a set of numbers which are arranged in rows and columns in a way to form a rectangular array. Also, the numbers are known as the elements, or entries, of the matrix. Also, matrices have wide applications in the physics, engineering, economics, and statistics along with the various branches of the mathematics....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.