using GMT
I = gdalread(TESTSDIR * "assets/coins.jpg");
Ibw1 = binarize(I);
Ibw2 = imfill(Ibw1);
grdimage(I, figsize=5)
grdimage!(Ibw1, figsize=5, xshift=5.1)
grdimage!(Ibw2, figsize=5, xshift=5.1, show=true)
Fill holes in the grayscale GMTimage I or UInt8 matrix I.
Here, a hole is defined as an area of dark pixels surrounded by lighter pixels.
I::Union{GMTimage{UInt8, 2}, GMTimage{Bool, 2}, Matrix{UInt8}, Matrix{Bool}, BitMatrix}: Input image.conn::Int: Connectivity for the image filling (4 or 8). Default is 4.
is_transposed::Bool: If true, it informs that the input image array is transposed. Default is true. Normally the GMTimage carries information to know about the transposition (which is true when the layout is “TRB”). When passing a matrix in column-major order (the default in Julia), is_transposed must be set to false. NOTE: The deaful is true because that is the normal case when reading a file image with gmtread or [gdalread].
layout::String: Layout of the input Matrix (default is “TRBa”). If the input is a GMTimage, this argument should have been set automatically and can normally be ignored.
Example from Matlab imfill.