Asked by lakshmikantha s
on 25 May 2013

This question is closed and may reopen in the future if edited.

I = imread('lena.jpg'); I=imresize(I,[250 250]); %I=im2bw(I); [x,y]=size(I); figure,imshow(I),title('Original Image') ; for ii=1:x for jj=1:y if(I(ii,jj)>=0&&I(ii,jj)<=50) I(ii,jj)=0; end if(I(ii,jj)>=51&&I(ii,jj)<=100) I(ii,jj)=50; end if(I(ii,jj)>=101&&I(ii,jj)<=150) I(ii,jj)=100; end if(I(ii,jj)>=151&&I(ii,jj)<=200) I(ii,jj)=150; end if(I(ii,jj)>=201&&I(ii,jj)<=256) I(ii,jj)=200; end

end end % figure,imshow(I) ; T1=I; T2=I; for i=1:x for j=1:y T2(i,j)=0; end end

w=11;

for i=1:x for j=1:y

if(T2(i,j)==0) l1=i; l2=j; ll1=l1; ll2=l2; rl=1; while(rl==1) ll1=ll1+1; ll2=ll2+1; if(ll1<=x&&ll2<=y) for ii=l1:ll1 for jj=l2:ll2 if(I(ii,jj)~=I(l1,l2)) rl=0; end end end else rl=0; end end if(ll1<=x&&ll2<=y) for ii=l1:ll1 for jj=l2:ll2

T1(ii,jj)=w; if(I(i,j)~=0) T2(ii,jj)=I(i,j); else T2(ii,jj)=1; end end end end

if(w<=250) w=w+24; else w=11; end

end

end end figure,imshow(T1),title('Original Image after Quad-Tree Optimization') ; ; figure,imshow(T2) ,title('Original Image after Restoration from quad-Tree') ; ;

Answer by Image Analyst
on 25 May 2013

I believe that is covered in the FAQ: http://matlab.wikia.com/wiki/FAQ#Can_you_program_up_the_algorithm_in_this_article_for_me_and_explain_it_to_me.3F but it can't hurt to ask - maybe you'll get lucky.

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments