magicwand

This function isolates all neighboring pixels with values within a present tolerance.
5.3K Downloads
Updated 20 Sep 2000

View License

Given an image and a pixel cooridinate, this function isolates all neighboring pixels with values within a preset tolerance. This function mimics the behavior of Adobe's Photoshop magic wand tool.

Y=magicwand(X, m, n);

Y=output image of type uint8(logical)
X=input image of type double
m=pixel cooridinate(row)
n=pixel cooridinate(col)

Y=magicwand(X, m, n, Tol);

Tol=Tolerance value for locating pixel neighbors(default=0.01)

Y=magicwand(X, m, n, Tol, eight_or_four);

eight_or_four=string such that if =='eigh', magicwand locates all eight-neighborhood pixels (default=four-neighborhood)

Cite As

Daniel Lau (2026). magicwand (https://uk.mathworks.com/matlabcentral/fileexchange/130-magicwand), MATLAB Central File Exchange. Retrieved .

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