saving image after using slider
1 view (last 30 days)
Show older comments
HI, I have problem with slider.
function slidergamma_Callback(hObject, eventdata, handles)
x=get(hObject,'Value');
imga=handles.imga;
imgas=imga.^x;
axes(handles.axes4);cla;
imshow(imgas);
set(handles.edit1,'String',num2str(x));
update(handles)
%guidata(hObject,handles);
It changes the value of gamma function . The function works but I need to safe image(handles.imga) and there is a problem. When I don´t use guidata(hObject,handles) at the end of the function ,the image is not upgraded and it always save the original image , when i use guidata(hObject,handles) saving works, but slider doesn´t work very well ( it doesn´t get real value of slider but I don´t now maybe it multiply values). Do somebody knows where is the problem?
Thanks a lot
j.
0 Comments
Answers (1)
Image Analyst
on 15 May 2013
Try
imgas= double(imga) .^ x;
axes(handles.axes4);
cla;
imshow(imgas, []); % The [] is important!
10 Comments
Image Analyst
on 16 May 2013
Well, are you calling imwrite() once or twice? From the code you showed, it looks like you're calling it just once, so why do you think it would save both images? However that was for some button callback, not the slider callback, which you haven't shown yet.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!