bugGNU Octave - Bugs: bug #47879, image package: imerode and...

 
 

bug #47879: image package: imerode and imdilate sets elements to Inf when SE is zero

Submitted by:  Artur Wegele <art645>
Submitted on:  Mon 09 May 2016 12:05:37 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Open/Closed: Closed
Release: otherOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 10 May 2016 05:42:53 PM UTC, comment #2:

I added several new test cases to imdilate and imerode.

http://hg.code.sf.net/p/octave/image/rev/e959fc1c7b0a

Some of them were failing but I have now push other changes so that they all pass and works coherently, i.e., when erosion or dilation get an empty set, they return that type maximum and minimum value. This should happen if SE is both an empty or blank, and also in cases where all of the SE would be outside the image (different cases in the code but mathematically need to behave the same).

From Artur Wegele via email:

> Should the function throw an exception, when the structuring element has a 0 overlapping with the image as in my case?
>
> I think the result is undefined same as if we divide 0/0. I expect imerode to deliver only values found in the source image. If there is no overlapping, then it can't work correctly.


If you are worried about this cases while at the same create unusual shaped SE, you can use the "valid" option of imerode.

---

I'm closing as invalid since after looking more into literature, Inf and -Inf can be considered correct valid. See http://stackoverflow.com/a/37117842/1609556

Carnë Draug <carandraug>
Project Member
Mon 09 May 2016 06:49:16 PM UTC, comment #1:

I originally asked the reporter to report it here since I thought it was a bug. I'm not so sure anymore. The issue can be generalized by using a SE of zero:

While searching the web, I found a post on stackoverflow asking why this odd result. I have compiled my thoughts on that answer here http://stackoverflow.com/a/37117842/1609556

This seems to boil down about finding min of an empty set, or whether erosion should compute min or infimum (same for imdilation). I would appreciate comments on this but I'm currently leaning towards actually being the correct answer (but I will be the first to admit to code it by accident).

Carnë Draug <carandraug>
Project Member
Mon 09 May 2016 12:05:37 PM UTC, original submission:

imerode sets the last pixel in the image to 1 in this.
Reproducable with the attached script ImErodeBug.m.

I expect imerode only to change pixel from 1 to 0, never from 0 to 1.

Artur Wegele <art645>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #37108:  img.png added by art645 (77B - image/png)
file #37109:  result.png added by art645 (76B - image/png)
file #37110:  strEl.png added by art645 (71B - image/png)
file #37111:  ImErodeBug.m added by art645 (148B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by art645 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 10 May 2016 05:42:53 PM UTCcarandraugCategoryOctave Forge Package=>Octave Function
      StatusNone=>Invalid
      Open/ClosedOpen=>Closed
      Release4.0.0=>other
      Operating SystemMicrosoft Windows=>Any
    Mon 09 May 2016 06:49:16 PM UTCcarandraugSummaryimerode Sets a bit to 1/Inf, when the center of the strel is 0=>image package: imerode and imdilate sets elements to Inf when SE is zero
    Mon 09 May 2016 03:55:45 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 09 May 2016 03:55:25 PM UTCrik5CategoryOctave Function=>Octave Forge Package
    Mon 09 May 2016 12:05:37 PM UTCart645Attached File-=>Added img.png, #37108
      Attached File-=>Added result.png, #37109
      Attached File-=>Added strEl.png, #37110
      Attached File-=>Added ImErodeBug.m, #37111

    Back to the top


    Powered by Savane 3.1-cleanup1