- don't save images by taking screenshots of the figure, unless you want the result to be arbitrarily resized and padded.
- don't save images as JPG, especially not for synthetic technical images -- especially not in MATLAB.
This is what your label image looks like.
That's not useful as a label image anymore.
You can try to un-ruin it, but good luck.
FG = imcrop(FG,[p0 fliplr(sza)-1]);
mk = ~bwareaopen(~mk,10);
outpict = labeloverlay(BG,L);
The result is still incomplete, since some of the small labeled regions are severely damaged or missing. Could it be improved? Probably, but the best way to fix a manufactured problem is to simply not create it. All this garbage could have been avoided by simply saving the original binary image or label array in a lossless format.
I know this example uses im2gray() and labeloverlay(), neither of which were available in 2015. I don't feel like playing time traveller tonight. I've posted plenty of examples that could replace im2gray(), and I believe I've done similar for the labeloverlay() composition task.