0
votes

I'm trying to use the imfill function from the Octave-Forge image package. I tried making a .m script and I also tried executing imfill function from the Octave GUI. Both times I get the same error:

error: imfill: interactive usage is not yet supported

What is "interactive usage"? I thought interactive usage was when you use the interactive interpreter. I thought writing a script, making it executable, and running it from the CLI was more like "batch mode".

If "interactive usage" is not supported then what kind of usage is supported? How do I use imfill?

Below I have included the offending code.

fn   = args{1};                                                                                                                                              
I    = imread(fn);                                                                

Igray = rgb2gray(I);                                                           
Ibw   = im2bw(Igray);                                                          

se_2x2square = strel("square", 2);                                             

Iedge  = edge(uint8(Ibw));                                                     
Iedge2 = imdilate(Iedge, se_2x2square);                                        
Ifill  = imfill(Iedge2);

And here is the actual code from imfill that is throwing the error.

   if (islogical (img))
      ## imfill (BW)
      error ("imfill: interactive usage is not yet supported");
    else
      ## syntax: imfill (img)
      fill_holes = true;
    endif
1

1 Answers

0
votes

I was confused by the term "interactive". The error is because I only gave imfill one argument. Currently calling imfill with only one argument (which I guess is interactive mode) is only implemented for grayscale images. Using a second parameter fixes the issue.

Ifill  = imfill(Iedge2, "holes");

, the arguments can be tweaked to get better results.