octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #62452] bwmorph spur produces wrong result


From: anonymous
Subject: [Octave-bug-tracker] [bug #62452] bwmorph spur produces wrong result
Date: Fri, 13 May 2022 08:32:57 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62452>

                 Summary: bwmorph spur produces wrong result
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 13 May 2022 12:32:56 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 7.1.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Documentation of the image package -> the function bwmorph -> the option
'spur' says that:

> Performs a remove spur operation. It sets pixel to 0 if it has only one
eight-connected pixel in its neighbourhood.

Given the following example:


a = [ 1 1 1 1 1
      1 0 0 0 1
      1 0 1 0 1
      1 0 1 0 1
      1 1 1 1 1];

b = bwmorph(a, 'spur');


It should produce:


b = [ 1 1 1 1 1
      1 0 0 0 1
      1 0 0 0 1
      1 0 1 0 1
      1 1 1 1 1];


But currently it returns the same array as the input.

I think changing the line 515 of bwmorph.m from


lut([18, 21, 81, 273]) = false;


to


lut([18, 19, 21, 25, 49, 81, 145, 273]) = false;


will solve the problem.

Moreover in the comments it is assumed that the function handle that makes
'spur' lookup table is:


lut = makelut(inline("xor(x(2,2),(sum((x&[0,1,0;1,0,1;0,1,0])(:))==0) ...
      &&(sum((x&[1,0,1;0,0,0;1,0,1])(:))==1)&&x(2,2))","x"),3);


But I believe that the correct generating function is:


lut = makelut(@(x) x(5) & (sum(x(:)) != 2), 3);






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62452>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]