Follow by Email

Lets Learn together... Happy Reading

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

MATLAB GUI EXAMPLE

function Multi_images()
%Simple GUI example to show how to use NEXT and BACK buttons.
%Images should be of same size and class.




i=1;%initialize the pointer
figure('units','pixels','position',[350 150 500 380],'menubar','none','numbertitle','off',...
            'name','GUI EXAMPLE(1)','resize','off');
NX = uicontrol('style','push','units','pixels','position',[265 10 150 30],...
                 'fontsize',14,'string','NEXT','callback',{@nextButton});
BK = uicontrol('style','push','units','pixels', 'position',[105 10 150 30],...
                 'fontsize',14,'string','BACK','callback',{@backButton});
set(BK,'visible','off');




FN = {'cameraman.tif','rice.png','testpat1.png'}';
no = numel(FN);%Returns the number of elements.
A = imread(FN{1});
imshow(A);




%Allocation: size, No of images, image type(uint8,uint16,logical,...)
images = zeros([size(A) no],class(A));
images(:,:,1) = A;


%Create multiple images array.
for inc = 2:no
    images(:,:,inc) = imread(FN{inc});
end




%Pushbutton function for NEXT
function  nextButton(source,eventdata)
if(i < = no)
i=i+1;
set(BK,'Visible','on');
set(NX,'Visible','on');
else
    set(NX,'Visible','off');
end
if(i==no)
    set(NX,'Visible','off');
end
imshow(images(:,:,i));
end




%Pushbutton function for BACK
function  backButton(source,eventdata)


if(i < = 1)
i=i-1;
set(NX,'Visible','on');
set(BK,'Visible','on');
else
    %Set the Back button invisible
    set(BK,'Visible','off');
end
if(i==1)
    %Set the Back button invisible
    set(BK,'Visible','off');
end
  imshow(images(:,:,i));
end




end
like button Like "IMAGE PROCESSING" page

1 comments:

Arun A M said... Reply to comment

Better you show images also how to develop. And i expect a scenario based explanation. This cant understand a beginner. Anyway, thank you .

Enjoyed Reading? Share Your Views

Previous Post Home

Link

Related Posts Plugin for WordPress, Blogger...
Google ping Hypersmash.com