Say that I have an integer matrix such as a mapped one:

In the image above, the dark borders are represented by the number 0 and are one pixel wide (please ignore the scaling artifacts).
Is there an efficient way to add missing dark borders in MATLAB? (white circles show examples of places where there are no borders).
I would like to ensure that each color area is completely covered by a dark border with a 4- pixel pixel connection.
Note that the solution will surely flip nonzero values to zero.
The corresponding matrix is of type uint32 (displayed in the color above).
EDIT: :
