Diana - the problem may be with this line of code
imbright=(handles.axes1)+val;
Note that you are adding a value val (calculated based on your slider position to the axes handle and not to the image. I think that what you want to do is save the image (that you have read from file) and then adjust it whenever the slider changes. Your pushbutton1 callback would become somethign like
function pushbutton1_Callback(hObject, ~, handles)
[filename pathname] = uigetfile({'*.jpg';'*.bmp'},'File Selector');
fullname=[pathname, filename];
ImageFile=imread(fullname);
axes(handles.axes1)
imagesc(ImageFile);
axis off;
handles.image = ImageFile;
guidata(hObject, handles);
Your slider callback would then look something like
function slider1_Callback(hObject, ~, handles)
if isfield(handles, 'image')
val=0.5*get(hObject, 'value')-0.5;
imbright=double(handles.image)+val;
imshow(uint8(imbright), 'Parent', handles.axes1);
end
Note the casting of the image to double before we add the val, and then the cast back to uint8 before we show it on the axes. One or both may not be necessary depending upon the original data type of the image.
Best Answer