How do I copy pixels from one image onto another image?
Afficher commentaires plus anciens
I'm new to MATLAB and have been trying to figure out how to copy a picture of myself onto another image. I've written code that allows me to drag my mouse to select pixels of an image, and then I can copy what I've selected in a matrix form, but I don't know what to do next or even if I'm going about this the right way. Any help would be greatly appreciated!!!
Also, could something like this work to remove the background of an image?
Foreground_image = imread('usbuddha.jpg');
Foreground_image = uint8(Foreground_image); %RGB values 0Black-255White
figure; fId = imagesc(Foreground_image); axis image; %Let me look at the foreground image
title('Drag mouse to select pixels for image'); %Tell me to draw defined space
A = imfreehand(); %Lets me freehand draw to select the certain pixels I want
maskImg = A.createMask;
4 commentaires
Jan
le 4 Avr 2014
Now we need an explanation what "copy onto another image" exactly means. Do you want to copy the data to the top left corner, resize it to cover the new picture completely or call imfreehand to mark a new area to copy the data into? Please post more details of what you are trying to achieve. We cannot guess this.
Rebecca Bullard
le 4 Avr 2014
Image Analyst
le 5 Avr 2014
For what it's worth, see my latest demo attached below. It lets you draw a freehand, irregularly shaped region in one image and paste it onto another image (which must be of the same size).
Rebecca Bullard
le 7 Avr 2014
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!