bugGNU Octave - Bugs: bug #46124, image package: bwfill should use...

 
 

bug #46124: image package: bwfill should use 4-connectivity as default

Submitter:  Hartmut <hardy>
Submitted:  Sun 04 Oct 2015 07:03:37 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 08 Aug 2016 08:35:51 PM UTC, comment #7: 
Hartmut <hardy>
Thu 04 Aug 2016 06:39:09 PM UTC, comment #6: 

OK, even in Matlab V2014b the bwfill command is still in. So they've only removed the documentation.

I will see what I can do with a new Octave command imfill.

Hartmut <hardy>
Wed 03 Aug 2016 07:44:10 PM UTC, comment #5: 

Alright, I'll try then to create a wrapper imfill.m to port all the already existing functionality of bwfill.cc to imfill.

I cannot give you a schedule for this. So please don't wait for this for any new release of the image package.

If I find the time and succed, the new m-file will then probably appear as a new topic in the PATCH tracker, and not here in this closed bug report.


Hartmut <hardy>
Wed 03 Aug 2016 02:02:58 PM UTC, comment #4: 


>  I didn't know of the existence of this old Matlab command bwfill, it must have been removed from Matlab at least 10 years ago (before the R2006a release, there is no older changelong on the Mathworks website).


At least R2010b still has bwfill. I'm not sure exactly when they removed it.

>  How do you like the idea of creating a new m-file IMFILL.M for Octave, that only acts as a compatibility wrapper for the existing bwfill.cc?


I'm wary of such temporary fixes because they often become permanent. I keep falling for that trap myself. But in this case it might useful because I guess that 2D binary input is the most case for imfill anyway.

Carnë Draug <carandraug>
Group Member
Wed 03 Aug 2016 11:45:48 AM UTC, comment #3: 

I fully agree to NOT change this, because there is/was also a Matlab version of bwfill. I didn't know of the existence of this old Matlab command bwfill, it must have been removed from Matlab at least 10 years ago (before the R2006a release, there is no older changelong on the Mathworks website). Here is some old documentation of it: http://www-rohan.sdsu.edu/doc/matlab/toolbox/images/bwfill.html .

So the real task would be to create an Octave version of IMFILL. Since imfill does not only deal with binary images, but also with grayscale images and Nd images, this task is too big for me to tackle it now.

How do you like the idea of creating a new m-file IMFILL.M for Octave, that only acts as a compatibility wrapper for the existing bwfill.cc? Then the Octave image package would have a Matlab compatible version of imfill, that can at least deal with (2d) binary images (but not with grayscale or binary images, yet). This smaller task might fit into my time budget. Let me know your thoughts on this.

Hartmut <hardy>
Tue 02 Aug 2016 08:56:02 PM UTC, comment #2: 

Actually this cannot be changed for Matlab compatibility. This function is compatible with Matlab's bwfill whose connectivity also defaults to 8 (I can't find documentation to bwfill on Matlab website now so I'm guessing they have removed it).

An implementation of imfill, with connectivity defaulting to 4 would be a better pursuit. It's a more difficult problem because it needs to handle grayscale and images with any number of dimensions.

I'm closing it as won't fix, but do comment if you have another view (or if you want to work on imfill).

Carnë Draug <carandraug>
Group Member
Tue 02 Aug 2016 08:35:23 PM UTC, comment #1: 

Here is a tiny PATCH to do the proposed change to bwfill.cc .

I would be happy to discuss if it makes sense to do this change.

(file #38080)

Hartmut <hardy>
Sun 04 Oct 2015 07:03:37 PM UTC, original submission:  

This can be oberved in the current image package (version 2.4.1):

As properly described in the help text of bwfill, this function uses as default value "8-connectivity".

The Octave function bwfill only works on binary images (as its name suggests) and substitutes the Matlab function imfill (that also works on other types of images).

The Matlab function imfill uses as default value "4-connectivity", this can for example be seen here: http://de.mathworks.com/help/images/ref/imfill.html#inputarg_conn

I thinks the Matlab default behavior is MORE USEFUL. For example if you use an edge detector (like the canny one) on an image, what you get is usually a 8-connected contour. In order to fill it (i.e. fill the background pixels inside this contour) you then need to fill something with a 4-connected behavior. Therefore currently the default setting in Octave FAILS on the (most common?) usecase of filling contours from edge extraction. This is why I like the Matlab default value better.

Could we change this behavior, to be Matlab compatible (and better! as described above)?


Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by hardy
  • -email is unavailable- added by hardy (Submitted the item)
  •  

    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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-02 carandraug Open/ClosedOpen Closed
    2016-08-02 carandraug Item GroupMatlab Compatibility Other
        StatusNone Wont Fix
        Release4.0.0 other
    2016-08-02 hardy Attached File- Added bwfill_defaultconnectivity=4.patch, #38080
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code