質問

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