문제

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