MATLAB: I have RGB (MxNx3) image and a binary mask (MxN). I want to place this mask over the RGB such that a line should be shown along the shape of the mask on the RGB image.

boundariesdigital image processingimage maskingimage processingImage Processing Toolboxmasking

The output should be some what like this

Best Answer

Call bwboundaries() then plot
boundaries = bwboundaries(binaryImage);
numberOfBoundaries = size(boundaries, 1);
hold on;
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'r-', 'LineWidth', 2);
end
hold off;