Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Examine the relationship between neighboring pixels in an image. Within a MAT-LAB script, open the image Dog.png and assign the image to a variable Irgb.

Examine the relationship between neighboring pixels in an image. Within a MAT-LAB script, open the image Dog.png and assign the image to a variable Irgb. This variable will be of size Height Width Channels. Begin by reducing the size of Irgb to Height Width and assigning it to a new variable Igray using MATLABs built-in conversion function for RGB to gray scale. Next, convert each pixel to either a 1 or a zero with the following mapping: \ Ibinary ( r, c ) = {0 if Igray( r, c )

(a) What is the probability that a pixel in the image Ibinary equals zero?

(b) What is the probability that a pixel in the image Ibinary equals one?

(c) Consider an experiment where you sample pairs of neighboring pixels in the image. Compute all possible joint probabilities be-tween pixels in the image and their neighbors to the right. Note: pixels in the rightmost column dont have neighbors to the right, so just ignore these.

(d) Are pixels independent of their neighbors?

(e) Bonus #1:If we encode the binary image using 1 bit per pixel,how many bytes would be required to store the image (roundup)?

(f) Bonus #2:Clearly, there is a strong dependence between neigh-boring pixels in the image, so we should be able to exploit this statistical dependency. Instead of encoding each pixel independent of the others, we could instead encode each row of the image using something called run-length encoding (RLE). One row of an image, with B representing a black pixel and W representing white, might read as follows (assuming each row in the image has 25 pixels):0000000111000000000111111With a run-length encoding applied to the above pixels, it can beencoded as follows:[0 : 7][1 : 3][0 : 9][1 : 6]where each pair in square brackets corresponds to the bit value and number of consecutive pixels with that value. If we use 1 bit to encode the bit value and 15 bits to encode the consecutive pixels, how many bytes would be required to store the image in RLE?

(g) Bonus #3:Save the binary image with MATLAB using the default .png format. How many bytes is the resulting image file?How does this compare to your RLE analysis?

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions