magicwand
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
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Neighborhood and Block Processing >
Tags
Acknowledgements
Inspired: Magicwand Corrected for v6.5, Simulating Photoshop's magic wand tool
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
