how to make top half image white in the frame ??

10 views (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 24 Aug 2016
Just set the values to 255:
[rows, columns, numberOfColorChannels] = size(rgbImage);
midRow = floor(rows/2);
rgbImage(1:midRow, :, :) = 255;
Image Analyst
Image Analyst on 1 Sep 2016
I hope you understand that I can't write the entire app for you. If I were you, I'd use a combination of a texture filter, like stdfilt(), and color segmentation, like the demos in my File Exchange:

Sign in to comment.

More Answers (1)

sai vallikat
sai vallikat on 1 Sep 2016
I tried this way it is working but is there any easy approach to do ??
if true
% code
i = imread('2.png');
i(1:350, 1:640, :) = 255;
i(1:480, 1:220, :)=255;
i(1:480, 440:640, :) =255;
i(450:480, 220:440, :)= 255;
  1 Comment
Image Analyst
Image Analyst on 1 Sep 2016
No, that's pretty much the best way, assuming you know the rows and columns like you do.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by