Multiscale Morphological Image Simplification in Matlab

Hi all I am currently trying to use the SMMT operator of the paper "Multiscale Morphological Image Simplification" at Dorini. Since the page cannot be accessed without subscription, I am posting the relevant details here:

在这里输入图像描述在这里输入图像描述在这里输入图像描述

Please Note that I am posting parts of the relevant article as images. I do not know how to write equations in stackoverflow.com . I want to use this SMMT operator as a pre-processing step in image processing. The code that I have written down is given below:

clc;clear all;close all;
tic
I=imread('handwritten.jpg');
I=I(:,:,1);

dim=11 ;
HEIGHT=zeros(dim,dim);
sigma=1/10;
for i=-floor(dim/2):floor(dim/2)
    for j=-floor(dim/2):floor(dim/2)
       HEIGHT(i+ceil(dim/2),j+ceil(dim/2))=-(1/sigma).*max(abs(i),abs(j));
    end
end
NHOOD=ones(dim,dim);
se = strel('arbitrary',NHOOD,HEIGHT);
se

IM1 = imdilate(I,se,'same');
IM2 = imerode(I,se,'same');
figure;
subplot(2,2,1),imshow(I)
subplot(2,2,2),imshow(IM1)
subplot(2,2,3),imshow(IM2)

II = I;
for i=1:1
    phi1 = imdilate(II,se,'same');
    phi2 = imerode(II,se,'same');
    for j=1:size(I,1)
        for k=1:size(I,2)
            if ((phi1(j,k)-II(j,k))<(II(j,k)-phi2(j,k)))
                II(j,k) = phi1(j,k);
            elseif ((phi1(j,k)-II(j,k))==(II(j,k)-phi2(j,k)))                
                II(j,k) = II(j,k);
            else
                II(j,k) = phi1(j,k);
            end
        end
    end
end
IM3=II;
subplot(2,2,4),imagesc(IM3,[0 255]);colormap('gray');axis off;
toc

The result of the code should be something like this : (again from paper): 在这里输入图像描述 .

My result is this:- 在这里输入图像描述 .

Is my implementation correct?? Can it be improved further ?? Any suggestions will be helpful. Thanks in advance for your help guys!! For more details refer to Dorini Free Access


The implementations looks ok globally, a small clarification though:

if ((phi1(j,k)-II(j,k))<(II(j,k)-phi2(j,k)))
                II(j,k) = phi1(j,k);

I guess here you would like to change the image value in variable II while comparing phi1 and I :

if ((phi1(j,k)-I(j,k))<(I(j,k)-phi2(j,k)))
                II(j,k) = phi1(j,k);
链接地址: http://www.djcxy.com/p/67292.html

上一篇: 清洁的形态操作

下一篇: Matlab中多尺度形态学图像简化