How can i delete a selected portion in an image and then paint it green?
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (1)
Geoff Hayes
am 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.
Kategorien
Mehr zu Display 2-D Images finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
