MATLAB: How to make top half image white in the frame ?

Image Processing Toolboximage segmentation

I am having an RGB image and I want to make top region of the image filled with white color.. The above is the RGB image with frame size 640 * 480
I want the upper half to make it white..
Any suggestions are greatly appreciated..! Thanks

Best Answer

  • Just set the values to 255:
    [rows, columns, numberOfColorChannels] = size(rgbImage);
    midRow = floor(rows/2);
    rgbImage(1:midRow, :, :) = 255;