How can I tune the threshold in majority operation with BWMORPH in Image Processing Toolbox 6.1 (R2009a)?
The majority action in BWMORPH sets a pixel to 1 if five or more pixels in its 3-by-3 neighborhood are 1s; otherwise, it sets the pixel to 0.
I would like to do it with a number different from five.
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
To apply a morphological operation on binary images similar to majority but with a different number of pixels as a threshold in Image Processing Toolbox 6.1 (R2009a) use the MAKELUT and APPLYLUT functions.
For example, you define the following function:
function Result = MyBWMorph (BW, n) f = @(x) (sum(x(:)) >= n); lut = makelut(f,3); Result = applylut (BW, lut);
This function sets a pixel from the BW image to 1 if 'n' or more pixels in its 3-by-3 neighborhood are 1, otherwise, it sets the pixel to 0.
SEE COMPLETE ANSWER CLICK THE LINK
Comments
Post a Comment