function scaleLine1=addScaleLine(im0,viewWidth,ind,textSize,lineWid)
%**************************************************************************
% This is a function to add scale line to the is situ plankton image.
% 1. Input 'im0 'is the image.
% 2. Input 'viewWidth' is the width of the real scene being filmed.
%
% Created By: Kaichang CHENG, Aug 14,2019
%**************************************************************************
myUnit=['cm','mm','¦Ìm'];
base=60;
imageWidth=size(im0,1);
len=imageWidth/viewWidth;
scaleLine0=insertText(im0,[base+len/2,base-30],{['1 ',myUnit((ind*2-1):ind*2)]},...
    'AnchorPoint','Center','Font','Times New Roman',...
    'FontSize',textSize+6,'TextColor','r','BoxOpacity',0);

scaleLine1 = insertShape(scaleLine0,'line',[base,base,base+len,base;...
    base,base-10,base,base+10;...
    base+len,base-10,base+len,base+10],'Color','r','LineWidth',lineWid,'Opacity',0);
end

