MATLAB: Changing the pixel value of a region defined by its contour points

contour pointsfill imageImage Processing Toolboxregion

Hi everybody how can i change the pixel of an object to white given that i have only positions of contour's point of the object?

Best Answer

binaryMask = poly2mask(x, y, rows, columns); % Make solid binaryMask.
grayImage(binaryMask) = 255; % Fill inside the mask with white.