over lap image onto another image??

조회 수: 11 (최근 30일)
miskie
miskie 2011년 3월 1일
편집: John Kelly 2015년 2월 27일
HI , im supposed to make a function
function [] = paste ( smallimage, bigimage, centerxy)
which returns the small image pasted onto the big image placed at [ x ,y] location center xy. the smallerimage is copied to overlay part of the big image, it will appear inside the bigimage and cover some of its pixels
I did not learn anything about copying and pasting images in class , and ive been searching the internet so much to find out how , but i cannot find any sites that teaches me how to do something like this
Do i do something like i=imread(smallimage) i=imcrop(i)
and then i dont know what else to do , how would i paste it in the other picture matrix?
is there impaste( location , bigimage)? oh jeez ive spent 40 of the past 48 hours trying to figure out matlab
  댓글 수: 2
Walter Roberson
Walter Roberson 2011년 3월 1일
Are smallimage and bigimage the _file names_ of images, or are they the image matrices ? imread() would be used if you are being passed the file names, but not if you are being passed the data.
You are not likely to have a use for imcrop.
If the function definition must be the one shown, then you cannot return anything from that function, which disagrees with your written requirements.
miskie
miskie 2011년 3월 1일
smallimage and bigimage are the file names yes ,
so at the start of my function it would be like
i=imread(bigimage);
h=imread(smallimage);
....
then i dont know what i could do
impaste? imoverlap? like is there a built in function to overlay an image or something?:

댓글을 달려면 로그인하십시오.

채택된 답변

Brett Shoelson
Brett Shoelson 2011년 3월 1일
Consider:
a = magic(7)
b = rand(2,3)
a(3:4,4:6) = b
% Or, more generally,:
startrow = 3;
startcol = 4;
a(startrow:startrow+size(b,1)-1,startcol:startcol+size(b,2)-1) = b;
Cheers,
Brett

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 3월 1일
편집: John Kelly 2015년 2월 27일
The result of reading in an image is a matrix. After your imread() you would have two matrices. You can copy one matrix to a particular place in another matrix.

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by