I am trying to create a cloud and cloud shadow masking raster using MFmask (https://www.sciencedirect.com/science/article/pii/S0034425717303073) for a Landsat 8 scene. MFmask 1.1 is modified version of Fmask 3.3 for better detection of cloud shadow in mountainous region using DEM. Previously I run Fmask 3.3 standalone and that worked, but the cloud/cloud shadow detection wasn't good enough and I moved to MFmask. It has no standalone, thus it has been run through MATLAB, but I got following error during the running in MATLAB.

>> addpath('D:\INSTALL\Cloud detection\MFmask\MFmask-master\MFmask-master\MFmask_1_1_beta')
>> autoMFmask

MFmask 1.1 version start.
Cloud, cloud shadow, and snow detection for Landsat 8 imagery.
Cloud/cloud shadow/snow dilated by 3/3/0 pixels (default).
Cloud probability threshold of 22.50% (default).
Loading input data.
From DNs to TOA ref & BT
Detecting clouds. This might take some minutes so be patient.
Error using imfill
Expected input number 1, I1 or BW1, to be non-NaN.

Error in imfill>parse_inputs (line 165)
validateattributes(IM, {'numeric' 'logical'}, {'nonsparse' 'real','nonnan'}, ...

Error in imfill (line 123)
[I,locations,conn,do_fillholes] = parse_inputs(varargin{:});

Error in plshadow2 (line 27)

Error in plcloud_ratelapse2 (line 228)
        Shadow=plshadow2( data_nir,data_swir,idlnd,mask,l_pt,...

Error in MFmask (line 5)

Error in autoMFmask (line 108)
    clr_pct = MFmask(fullfile_path,norMTL.name,demtype,cldpix,sdpix,snpix,cldprob,num_Lst,num_near,gap_off); % newest version

How can I handle these issues? Such errors could be found during running of Fmask as well.


This bug is because Matlab imfill function cannot process Nan value. Anyway, this bug has been fixed in the MFmask. Everyone can download the MFmask package at https://github.com/qsly09/MFmask. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.