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

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

[Octave-bug-tracker] [bug #50874] [octave forge] (image) bwdist call cau


From: Avinoam Kalma
Subject: [Octave-bug-tracker] [bug #50874] [octave forge] (image) bwdist call causes application crash
Date: Thu, 15 Nov 2018 15:29:45 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36

Follow-up Comment #6, bug #50874 (project octave):

There are few problems with bwdist

* If all the entries are zero, the result should be all NaNs:


Octave:
>> bwdist ([0 0; 0 0])
ans =

   4.5253e+04   4.5254e+04
   4.5254e+04   4.5255e+04
Matlab:
>> bwdist ([0 0; 0 0])

   Inf   Inf
   Inf   Inf


* bwdist crashes on row vectors 
* bwdist gives wrong results on column vectors:


Octave:
>> bwdist([1 0 0]')
ans =

   0.0000e+00
   4.5255e+04
   4.5255e+04
Matlab:
ans =

     0
     1
     2


Please review the attached patch. It treats the 1D problem
(and I have to add some relevant test).
The method is to increase the distance after we meet a zero, 
and do it again in the opposite direction.

How do I return a NaN matrix for the first case (has_ones == 0 in the code).


(file #45434)
    _______________________________________________________

Additional Item Attachment:

File name: bwdist.patch                   Size:1 KB


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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