Skip to content

Instantly share code, notes, and snippets.

View juniorhero's full-sized avatar
:octocat:

Athul Jayaram juniorhero

:octocat:
View GitHub Profile
saveas( handles.axes2 , 'D:/maj proj/samples/output.jpg' );
F = getframe(handles.axes2);
Image = frame2im(F);
imwrite(Image,'D:/folder/output.jpg','jpg');
if (strcmp('a','radiobutton1')
imshow(c,'Parent',handles.axes2);
elseif (strcmp('b','radiobutton2'))
imshow(b,'Parent',handles.axes2);
end
function pushbutton1_Callback(hObject, eventdata, handles)
a=get(handles.edit1, 'string');
b=imread(a);
c=rgb2gray(b);
imshow(c,'Parent',handles.axes2);
image=get(handles.edit1, 'string');
imshow(image,'Parent',handles.axes2);
imgurl = strcat(pn,fn);
set(handles.edit1,'string',imgurl);
I = imread(imgurl);
imshow(I,'Parent',handles.axes1);
guidata(hObject, handles);
@juniorhero
juniorhero / gist:445fd369af3a79560f839b230950cae5
Created August 27, 2016 19:58
Select Files with Specific File Types using Dialog Box in Matlab GUI
function pushbutton2_Callback(hObject, eventdata, handles)
% above line of code is default line ofcode for button
% an example to open image files only
% when button is clicked, a dialog box appears to select the file
handles.output = hObject;
[fn pn] = uigetfile( {
'*.png;*.jpg;*.jpeg;*.gif','Image Files (*.png, *.jpg, *.jpeg, *.gif)'; ...
@juniorhero
juniorhero / gist:94f55a18f76da3001cfcd065afc607ba
Created August 27, 2016 18:39
Matlab GUI Button Press Fetches Image url and Show Image
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
handles.output = hObject;
[fn pn] = uigetfile('*.png','select png file');
complete = strcat(pn,fn);
set(handles.edit1,'string',complete);
I = imread(complete);
imshow(I,[]);
% code by juniorhero to show image in axes in gui
axes(handles.axes2);
imshow('D:\maj proj\samples\Lenna.png')
@juniorhero
juniorhero / matlab negative of image
Created August 26, 2016 20:22
matlab negative of image
a=imread('Koala.jpg');
b=255-a
subplot(1,2,1)
imshow(a)
title 'Original Image'
subplot(1,2,2)
imshow(b)
title 'Negative Image'