How to open image using fopen and preprocess in GUI

I want to select raw image using "pushbutton" 'Select Image'
Then using another "Pushbutton" 'Preprocess' I want to pre process the same
The whole code is
fi=fopen('JPCLN001.img','r','b');
img=fread(fi,[2048 2048],'*uint16','b');
img1=mat2gray(img, [0,4096]);
img2=imrotate(img1,-90);
img2=flip(img2,2); %Horizantal Flip
%subplot(1,2,1);
figure,imshow(img2),title('Original');
img3=imcomplement(img2);
%subplot(1,2,2);
figure,imshow(img3),title('negative');
medf=medfilt2(img3,[3 3]);
%subplot(1,2,1);
figure,imshow(medf),title('Med_filtered');
img4=imadjust(medf);
%subplot(1,2,2);
figure,imshow(img4),title('Contrast1');
img5=histeq(img4);
%subplot(1,2,1);
figure,imshow(img5),title('Hist_Equa');

Answers (2)

Walter Roberson
Walter Roberson on 5 Jul 2015
Edited: Image Analyst on 5 Jul 2015
Have the callback function for uicontrol('style','push') call uigetfile() . Store the information about the directory and the file name in a place that can be found by the pushbutton for preprocessing.

2 Comments

If it is so, how it would be with above code given? As I am new to GUI
@Dnyanesh Kanade: As soon as you try it by your own, you will not be new in this field anymore. Read the suggested tutorials and you are an experienced GUI programmer. Just try it and post, what you have written so far in case of problems.

Sign in to comment.

To learn the basics about creating GUI programmatically (not using GUIDE) see: http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples

3 Comments

Thanks but not useful tutorials for image processing.
I've uploaded several tutorials into my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862, along with several hundred others I've uploaded to the Answers forum. What do you need? Steve Eddins blog also posts Image Processing Tutorials: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
@Dnyanesh Kanade: You did not ask a question about image processing, but about using buttons. The usage of buttons is explained very well in these tutorials.

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 5 Jul 2015

Commented:

Jan
on 5 Jul 2015

Community Treasure Hunt

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

Start Hunting!