how to pass mat files by reference to the function?
Afficher commentaires plus anciens
net=load('data/vgg_face.mat');
% --- Executes on button press in upl_img.
function upl_img_Callback(hObject, eventdata, handles)
%passing the image to the network
im_ = single(im) ; % note: 255 range
im_ = imresize(im_, net.meta.normalization.imageSize(1:2));
im_ = bsxfun(@minus,im_,net.meta.normalization.averageImage);
res = vl_simplenn(net, im_);
scores = squeeze(gather(res(end).x));
[bestScore, best] = max(scores);
% printing scores
set(handles.output_score, 'String', net.meta.classes.description{best});
guidata(hObject,handles);
I want the mat file loaded in 'net' to be used inside the function upl_img_callback. How can i do so. I cannot declare net inside the function since everytime this function is called this huge mat file(1 GB) is loaded into the ram again. net is defined in the m file like shown. I don't know how to pass it as argument either since this mat file is defined in the same m file as the function. Please help.
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 24 Juil 2016
0 votes
See the FAQ for several options: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Catégories
En savoir plus sur Whos dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!