Hello,
the task I've got is to make a programme where the user can choose the image file from any directory and in one block it shows original image, while in the second it shows the same image with adjusted brightness, which is controlled with slidebar. As I'm totally new in working with this programme, it sounds and looks extremely hard for me.
I've been "googling" for weeks, but still there left some questions.
The questions are:
- how can i make the slidebar for regulating brightness for the second image?
- how to make to read both- colorful and bw- images correctly?
Here's my code that I wrote so far (without the beginning, which never changes as I understand) :
function pushbutton1_Callback(hObject, eventdata, handles)[filename pathname] = uigetfile({'*.jpg';'*.bmp'},'File Selector');fullname=[pathname, filename];ImageFile=imread(fullname);axes(handles.axes1)imagesc(ImageFile);axis off;set(handles.text2, 'string', fullname);axes(handles.axes2)imagesc(ImageFile);axis off;% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)axes(handles.axes2);[filename, foldername] = uiputfile('Kur norite issaugoti faila?');complete_name = fullfile(foldername, filename);imwrite(TheArray, complete_name);% --- Executes on slider movement.
function slider_Callback(hObject, eventdata, handles)valor=get(hObject, 'value');set(handles.texto,'string',num2str(valor));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.
function slider_CreateFcn(hObject, eventdata, handles)if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]);endfunction texto_Callback(hObject, eventdata, handles)edit=get(hObject,'string');set(handles.slider,'value',str2num(edit));guidata(hObject,handles);axes(handles.axes2)val=0.5*get(handles.axes2, 'value')-0.5;imbright=(handles.axes2)+val;imshow(imbright);axes(handles.axes2);% --- Executes during object creation, after setting all properties.function texto_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end
Thank you in advance!
~you might save the day and the life for the human~
Best Answer