My image is a white map of Italy with black (actually various shades of gray) borders which outline every province of the country. The objective is to fill some provinces with black. I read about the imfill function, but since it fills black regions with white colors, I manually edited the image so that every province is filled with black. In this way I can use imfill to fill the provinces with white. The following code fills two adiacent provinces:
I = imread('https://i.imgur.com/w6osODY.png');
BW = imbinarize(I,.2);
A = imfill(BW,[760 420]);
imshow( imfill(A,[780 480]) )
otherwise, since the borders are white, when the provinces are filled with white, their borders vanish, see image below
Is there a way to fill the provinces while keeping the borders visible? Or, alternatively, a way to fill with black the provinces of the white map? (link for the white map https://i.imgur.com/v7g4J0n.png) Or a way to fill with a color different from black?
EDIT: I'm trying to superimpose the white map above the one obtained with the imfill function.