How to soften the boundaries within a matrix
2 views (last 30 days)
Andres Salomon Fielbaum Schnitzler on 21 Feb 2022
I have a matrix M, size N1xN1, which only has positive integers, and is delimited by zones, as seen in the following picture created using image(M) (I changed the colormap and the axes, but that is not relevant for this question)
What I would like to know if there is a way to soften the boundaries between each area, i.e., that the curves do not seem discretized, but interpolated.
Thanks in advnace for any help
Image Analyst on 21 Feb 2022
You can blur the matrix and rediscretize it.
windowWidth = 9;
kernel = ones(windowWidth) / windowWidth^2;
blurredImage = conv2(M, kernel, 'same');
% Now call discretize to quantize into the levels you had.