필터 지우기
필터 지우기

how to write zoom code with scale for an rgb image

조회 수: 2 (최근 30일)
alireza kooshafar
alireza kooshafar 2016년 10월 21일
댓글: Walter Roberson 2016년 10월 22일
i write this one for gray image but i looking for rgb's too (nearest neighbor)
I1=[50 80 100 ; 115 21 90 ;32 50 160];
S=2 ;
[M , N]=size(I1);
M2=S*M;
N2=S*N;
I2=zeros(M2 , N2);
for i =1:M2
for j = 1:N2
x =i/S;
y=j/S;
x2=round(x);
y2=round(y);
if (x2<1)||(x2>M)||(y2<1)||(y2>N)
I2(i , j)=0;
else
I2(i,j)=I1(x2 ,y2);
end
end
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 10월 22일
for Channel = 1 : 3
I1 = YourImage(:,:,Channel)
now do the zooming here, just like above except without the assignment to I1
I3(:, :, Channel) = I2;
end
  댓글 수: 2
alireza kooshafar
alireza kooshafar 2016년 10월 22일
tnx i get the way but not this part''except without the assignment to I1''
Walter Roberson
Walter Roberson 2016년 10월 22일
Your very first line was
I1=[50 80 100 ; 115 21 90 ;32 50 160];
Omit that line completely. Instead, before the loop, initialize YourImage to be an appropriate RGB image.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by