How can i delete a selected portion in an image and then paint it green?
Show older comments
I am doing a work on inpainting procedure, for that i am in requirement of a code that deletes a selected portion in an image and colors that region green i.e.(RGB =0 255 0)? Can anybody help
Accepted Answer
More Answers (1)
Geoff Hayes
on 4 Apr 2015
Sandeep - if you know the region of the region that needs to be coloured green (and if we assume that the region is rectangular) then you could try something like
% create a black image
myImg = zeros(400,400,3);
% colour the top left-corner
greenPatch = zeros(200,200,3);
greenPatch(:,:,2) = 255;
myImg(1:200,1:200,:) = greenPatch;
% display the image
image(uint8(myImg));
Note that we size the green patch to be such that it will fill the deleted portion of myImg.
Categories
Find more on Display 2-D Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!