bugGNU Octave - Bugs: bug #41709, image-2.2.0 - bwdist giving wrong...

 
 

bug #41709: image-2.2.0 - bwdist giving wrong results on simple array

Submitter:  None
Submitted:  Wed 26 Feb 2014 03:01:52 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  carandraug
Originator Name:  Benoit Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 08 Mar 2014 01:51:16 AM UTC, comment #5: 

For what is worth, I have just made the 2.2.1 release which has this bug fix.

Carnë Draug <carandraug>
Group Member
Sat 08 Mar 2014 01:00:58 AM UTC, comment #4: 

I have fixed this with changeset 875:9a76652a01f5

The problem happened when the code originally had variable "h" for width and "w" for height. Note that they are swapped. I can only guess why but probably because the code was originally written for row-major order
and it would be easier to swap the assignment to these two variables than all instances of it in the code.

It should be fixed, and I added this case to the test suite of the image package.

This fix will be released with the next stable release, version 2.2.1 which should be soon.

Carnë Draug <carandraug>
Group Member
Fri 07 Mar 2014 06:16:08 PM UTC, comment #3: 

I gave it a quick look and it seems that this bug only presents for elements on the top and bottom row. The distance calculation is correct, it's the x and y dist that appear to be swapped.

Carnë Draug <carandraug>
Group Member
Wed 26 Feb 2014 10:19:25 PM UTC, comment #2: 

You are right, that's a regression. If you can provide a patch for this, it's very welcome but at the moment I'm unable to do so.

Carnë Draug <carandraug>
Group Member
Wed 26 Feb 2014 03:08:02 PM UTC, comment #1: 

and the remaining of the original post...

Result for C is:

Octave 3.8.0 - Image 2.2.0
C =
 1   5   9  13  16  21  25  29  33
 2   6  10  14  13  22  26  30  34
 3   7  10  15  19  23  27  31  35
 5   8  12  16  20  24  28  32  36

Note that the value in row 1 col 4 is 5. This is incorrect, it should be either 3 or 8! Same in row 5 cols 1 and 2.

In image-2.0.0, a more sensible value for C is produced:

Octave 3.8.0 - Image 2.0.0
C =
  1    5    9   13   13   21   25   29   33
  2    6   10   14   14   22   26   30   34
  3    7   10   15   19   23   27   31   35
  8    8   12   16   20   24   28   32   36

Comments?

Regards,
Benoit

Anonymous
Wed 26 Feb 2014 03:01:52 PM UTC, original submission:  

The example below demonstrates that the linear index (C) is not correct (as in [D,C] = bwdist(BW, METHOD)):


im=[1,2,3,4,NaN,6,7,8,9; 2,3,4,5,NaN,7,8,9,10;3,4,NaN,6,7,8,9,10,11; NaN,5,6,7,8,9,10,11,12];
mask = ~isnan(im);
[dist,C] = bwdist(mask,'euclidean');  % euclidean, chessboard, cityblock, quasi-euclidean
C


Result for C is:

% Octave 3.8.0 - Image 2.2.0
% C =
%   1   5   9  13  16  21  25  29  33
%   2   6  10  14  13  22  26  30  34
%   3   7  10  15  19  23  27  31  35
%   5   8  12  16  20  24  28  32  36
-verbatim+

Note that the value in row 1 col 4 is 5. This is incorrect, it should be either 3 or 8! Same in row 5 cols 1 and 2.

In image-2.0.0, a more sensible value for C is produced:
+verbatim+
% Octave 3.8.0 - Image 2.0.0
% C =
%    1    5    9   13   13   21   25   29   33
%    2    6   10   14   14   22   26   30   34
%    3    7   10   15   19   23   27   31   35
%    8    8   12   16   20   24   28   32   36
-verbatim+

Comments?

Regards,
Benoit

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only group members can vote.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2014-03-08 carandraug StatusNone Fixed
    Assigned toNone carandraug
    Open/ClosedOpen Closed
2014-02-26 carandraug Operating SystemMicrosoft Windows Any

Back to the top

Powered by Savane 3.13-758e.
Corresponding source code