how to control the position of an image inside another one?

조회 수: 9 (최근 30일)
Youssra
Youssra 2015년 4월 17일
댓글: Geoff Hayes 2015년 4월 18일
Hi, I need your help please. I'm working in Matlab and I have tow images one with size 256*256 and the other one with size 64*64. I want to embed the small image into the first one but i would like to control the position of the embedding process. For example having the small image in the corner of the big image and then I want to changing in the middle ... do you have any idea how ? thank you

채택된 답변

Image Analyst
Image Analyst 2015년 4월 18일
See my copy and paste demo. It does this.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2015년 4월 18일
Youssra's answer moved here
okey, thank you so much for your answers guys, I will try them both. ^^

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

추가 답변 (1개)

Geoff Hayes
Geoff Hayes 2015년 4월 18일
Youssra - suppose that you have a red and a blue image
redImg = uint8(zeros(256,256,3));
redImg(:,:,1) = uint8(255);
blueImg = uint8(zeros(64,64,3));
blueImg(:,:,3) = uint8(255);
To embed the smaller into the larger, say in the top left corner, you could do
redImg(1:64,1:64,:) = blueImg;
image(redImg);
Note how we assign the blueImg matrix of dimension 64x64x3 into the appropriately sized portion (same dimension) of the redImg matrix.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by