Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imroifill #14

Open
Yukiya-Kawakami opened this issue May 11, 2024 · 0 comments
Open

imroifill #14

Yukiya-Kawakami opened this issue May 11, 2024 · 0 comments

Comments

@Yukiya-Kawakami
Copy link

Hi,

I'd like to report that I find an issue in the imroifill.sci that
worked on the previous version of Scilab but doesn't work on 2024.0 version.
And I also present my proposed correction below.
Please confirm the issue of imroifill.sci and correct it.

result = imin;
///
maskb = im2bw(mask,0.5);
perimeter=bwborder(maskb);
interior = im2bw(mask,0.5) & ~im2bw(perimeter,0.5);
idx = find(interior);
grid = zeros(mask);
grid(idx) = 1:length(idx);
[M,N] = size(grid);
perimValues = zeros(M,N);
perimIdx = find(perimeter); 
perimValues(perimIdx) = imin(perimIdx);
rightside = zeros(M,N);
rightside(2:(M-1),2:(N-1)) = perimValues(1:(M-2),2:(N-1)) + ...
perimValues(3:M,2:(N-1)) + perimValues(2:(M-1),1:(N-2)) + ...
perimValues(2:(M-1),3:N);
rightside = rightside(idx)';  // <- from rightside(idx)
i = grid(idx)'; // <- from grid(idx)
j = grid(idx)'; // <- from grid(idx)
s = 4*ones(idx)';            
idx = idx';
for k = [-1 M 1 -M]
    // Possible neighbors in the k-th direction
    Q = grid(idx+k);
    // Index of points with interior neighbors
    q = find(Q)';
    // Connect interior points to neighbors with -1's.
    //pause
    i = [i; grid(idx(q))]; // <- from grid(idx(q))'
    j = [j; Q(q)];
    s = [s; -ones(length(q),1)];
end

D = sparse([i,j],s);
x = D \ rightside;
result(idx) = x;

// best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant