MATLAB Answers

Sliding window search and Entropy value for each window

9 views (last 30 days)
Hessah Mohammad
Hessah Mohammad on 3 Feb 2020
Answered: Subhadeep Koley on 3 Feb 2020
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?

  0 Comments

Sign in to comment.

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

  0 Comments

Sign in to comment.


Translated by