Question: # STEP 2 Define a vector source by combining two consecutive pixels # and calculate the probabilities of these vector symbols # ADD YOUR CODE
# STEP 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 intensity levels, there will be x 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 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 b Calculate the entropy of the vector source per input source symbol
# ADD YOUR CODE HERE
# note:
# divide the vector entropy value by to find the entropy per input source symbol
# print the value of the entropy of the vector source per input source symbol
def myEntropypdf:
assert pdfndim
size pdfsize
entropy
for i in rangesize:
val pdfi
if val:
entropy val math.logval
return entropy
entropyvector myEntropypdf
entropypersymbol entropyvector
printfEntropy of the vector source per input source symbol: entropypersymbol
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
