matlab - Smoothing edges in a colormap image -


i have square matrix of size 'n' made of numbers (1 n) irregular clustered.for example 7's together, 10's together, etc, irregularly. using "image , colormap" command matrix each cluster colored differently square edges.. want ruffle edges there smooth boundary between each color. need ramps in place of steps! beginner in matlab. pl help...........

you can convolve array kind of low-pass (i.e. smoothing) filter. if want ramps straight lines, can use average filter; if want ramps sigmoidal, can use gaussian filter. size of filter window determines width of ramp.

for example, use 3x3 average filter (which give ramps of width 3 pixel), you'd following:

%# pad image twice replicating borders avoid border effects %# use padarray instead if have image processing toolbox tmp = img([1 1 1:end end end],[1 1 1:end end end]); %# apply convolution. normalize filter sum %# of pixels in filter 1, , use 'valid' option %# automatically discard padding. smoothimg = conv2(tmp,ones(3)/9,'valid'); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -