Sliding window search and Entropy value for each window

9 views (last 30 days)
Hello, I want some help here
I need to apply Sliding window search in image, and calculate the Entropy value for each window (I looking for highest Entropy value in the image),
Here is the pseudo code:
(1) Sliding window search
Emax=0
For each window Wi
Compute the Entropy Ei
If Ei > Emax
Then update Emax
End
End
Can someone help me with that please?

Answers (1)

Subhadeep Koley
Subhadeep Koley on 3 Feb 2020
Hi, refer the code below. It calculates entropy values for different (16x16) window of an image and displays them as a heatmap.
clc; close all;
% Read the image
img = im2double(imread('cameraman.tif'));
% Define the function handle
fun = @(block_struct) entropy(block_struct.data);
% Distinct block processing for the image
blockEntropy = blockproc(img, [16 16], fun);
% Display heatmap for visualization
figure; heatmap(blockEntropy); colormap hot;
blockEntropy.png

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!