Unexpected error with imfill

5 visualizzazioni (ultimi 30 giorni)
Dante Basile
Dante Basile il 12 Lug 2019
Risposto: Walter Roberson il 13 Lug 2019
I am attempting to use imfill to floodfill a donut shaped binary matrix. I am using version R2018b. I want to fill the donut (not the central hole) by sepecifying a pixel coordinate within the "dough". I am trying to run this command:
testFill = imfill(testShape, [3 3], 4)
As reccomended by the documentation:
BW2 = imfill(BW1,[3 3],8)
However, I get this error:
Error using imfill>parse_inputs (line 248)
Expected input number 3, OPTION, to match one of these values:
'holes'
The input did not match any of the valid values.
Error in imfill (line 124)
[I,locations,conn,do_fillholes] = parse_inputs(args{:});
Caused by:
Error using validatestring>checkString (line 89)
Expected input to be one of these types:
char, string
Instead its type was double.

Risposta accettata

Walter Roberson
Walter Roberson il 13 Lug 2019
That particular syntax is only valid if your input array is type logical, but your BW1 is some other data type. For example, it would not be enough for the array to be double(0) and double(1), or uint8(0) and uint8(1), or uint8(0) and uint8(255) : it must be logical.

Più risposte (0)

Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by