Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# STEP 2 Define a vector source by combining two consecutive pixels # and calculate the probabilities of these vector symbols # ADD YOUR CODE

# STEP 2 Define a vector source by combining two consecutive pixels
# and calculate the probabilities of these vector symbols
# ADD YOUR CODE HERE
# notes:
# since each pixel has 8 intensity levels, there will be 8x8=64 symbols in the vector source.
# the symbols for the vector source could be represented as "aa, ab, ac,..., hf, fg, hh."
# there are a total of 512*512/2=131,072 sample vectors in the input image to calculate the histogram
# calculate the histogram of the vector symbols
# obtain the pdf by normalizing the histogram
# plot the pdf of this vector source# STEP 3.b Calculate the entropy of the vector source per input source symbol
# ADD YOUR CODE HERE
# note:
# divide the vector entropy value by 2 to find the entropy per input source symbol
# print the value of the entropy of the vector source per input source symbol
def my_Entropy(pdf):
assert pdf.ndim ==1
size = pdf.size
entropy =0.0
for i in range(size):
val = pdf[i]
if val:
entropy +=- val * math.log2(val)
return entropy
entropy_vector = my_Entropy(pdf)
entropy_per_symbol = entropy_vector /2
print(f"Entropy of the vector source per input source symbol: {entropy_per_symbol}")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions