Shannon Edge Detector for Grayscale Images

This is an edge detector for grayscale images based on the Shannon Entropy measure for biodiversity.
537 Downloads
Updated 8 Jun 2015

View License

The Shannon algorithm runs an edge detector method using a Shannon Entropy measure. The .zip folder contains three files, the main file, which is the Shannon Algorithm, an edge detector file and a threshold file. You will need all three files.
To edge detect a gray scale image, input the file name into the main file and click run.

A Shannon entropy-based edge detector is a new method, inspired by biodiversity measures.

I hope you find it useful. Below is a snippet of code from the Edge Detector procedure. It utilizes a 3x3 window.

% Edge Detector
function [g]=EdgeDetector_procedure(f);
[row column]=size(f);
g=f;
m = 3; n = 3; a0 = (m-1)/2; b0 = (n-1)/2;
for y = b0+1 : column-b0;
for x = a0+1 : row-a0;
sum1 = 0;
for k=-b0:b0;
for j=-a0:a0;
if ( f(x,y) == f (x+j,y+k) ) sum1=sum1+1; end;
end;
end;
if ( sum1>6 ) g(x,y)=0; else g(x,y)=1; end;
end;
end;

Cite As

Tyler Coye (2026). Shannon Edge Detector for Grayscale Images (https://uk.mathworks.com/matlabcentral/fileexchange/51124-shannon-edge-detector-for-grayscale-images), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0