Could you please help me with this question:

Assume that on average in binary images, 75% of the pixels are white, and 25% are black. What is the entropy of this source? Model this source in Matlab and generate some sample images according to this process

有帮助吗?

解决方案

To find the entropy, you just need to apply the definition:

H = -0.25 * log2(0.25) - 0.75 * log2(0.75)

Since we are using log2, the result will be in bits.

As for generating a Matlab B&W (i.e. binary) image of size 512x512, you can simply do:

im = rand(512) < 0.75;

By convention, true = 1 = white and false = 0 = black.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top