# How to find sub-block entropy and Bit-Plane entropy of a gray scale image??

3 views (last 30 days)
I am new to matlab. I was trying to find the global and local entropy of an image using matlab for implementing a research paper using matlab.
e = entropy(I) this function is available to find the global entropy of an image using matlab. Now when it comes to local entropy there are 2 kinds of it.
1. sub-block Entropy
"Sub-block entropy (k,TB) with respect to local k number of non-overlapping sub-blocks S1,S2,......Sk. each of size BT within ,S are obtained by finding entropy H(Sk) over all the sub-blocks. The size of an image should be reasonable to get the fair estimate of Shannon entropy. Also, the value of k and BT should be adequate in number and size respectively to get fair values of local Shannon entropy. A k number of sub-blocks of S can be taken in non-overlapping manner randomly instead of all the sub-blocks of S. Average sub-block local entropy is taken as the average of local entropies computed for a number of different sub-blocks to fairly cater the local randomness of S."
Now to implement the above sub-block entropy I tried to divide the image into k non-overlapping sub-blocks. I have tried what is mentioned in the link https://in.mathworks.com/matlabcentral/answers/324809-how-to-divide-an-image-into-non-overlapping-blocks but it is generating few errors.
2.bit-plane Entropy
When global and sub-block entropy measures are not giving information of local non-randomness of ,S we can compute local entropy for bit-planes of S in a non-overlapping manner as similar to sub-blocks local entropy to see the non-randomness of S at bit-plane level.
For an image (Sx,y) with 8 bit/pixel, we have 8 different bit-planes, (bx,y,k),k=1 to 8 where k indicates the number of bit-planes. Bit-plane (bx,y,1) is known as most significant bit (MSB) plane and (bx,y,8) is known as least significant bit (LSB) plane.
I could not understand much on how to implement the bit-plane entropy.

Image Analyst on 31 Jul 2021
I didn't go over your message in detail but my viewbitplanes demo should help. Plus there is an entropfilit() function but those windows move over one pixel at a time and so overlap. To have non-overlapping window locations, you need to use blockproc(). I'm attaching demos for that too.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by