部分地理校正后tiff图会出现黑边区域,有时会影响后续的处理过程,一个简单的自动掩膜技巧。
function Mask = Tiff_AutoMask( img )
%Geotiff may have black side,this function is designed for creating a auto-mask for further processing. Mask will be a binary image with img size
% Input: img(8bit greyscale image with blackside(all zero area))
% Output: Mask(a binary image with img size,black side part will be the only black part)
% First designed by bloodbbay at 2015.08.10
%% Get Basic Info
img_copy = img; %make a copy of input image
Peak = max(img_copy(:));