Wednesday 13 February 2013

Making a Photoviewer with GUI using Matlab

Code :


clc;
imr=input('Enter the full path of the image frames:','s');
somefolder=imr;
filelist=dir(somefolder);
for i=1:size(filelist,1)
    if filelist(i).isdir ~=true
        fname=filelist(i).name;
        if strcmp(fname(size(fname,2)-3:size(fname,2)),'.jpg')==1
            tmp=imread([somefolder fname]);
            if size(tmp,3)==3;
                tmp=imresize(tmp,[400,400],'bilinear');
                imshow(tmp);
                pause(1);
                disp([fname,':loaded']);
            end
        end
    end
end

Building GUI :

If you dont know how create basic matlab GUI then you can see my previous post :

Building GUI with Matlab

Step 1 : I have made a very simple interface,drawn just a button  and an axes


Step 2 : Now open the GUI .m file by clicking view and then m-file editor



Step 3: Now paste the above code in the pushbutton_callback function and save

Step 4: Now run the code,press play button,then it should ask for the image folder path,write the path press          enter it will show the images

1 comment:

  1. Grateful to check out your website, I seem to be ahead to more excellent sites and I wish that you wrote more informative post for us. Well done work.

    ReplyDelete