Автор работы: Пользователь скрыл имя, 21 Ноября 2012 в 21:44, реферат
Matlab – это система инженерных и научных вычислений. Она обеспечивает математические вычисления, визуализацию научной графики программирование и моделирование процессов с использованием интуитивно понятной среды окружения, когда задачи и их решения могут быть представлены в нотации, близкой к математической.
% hObject handle to editContrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'
set(hObject,'BackgroundColor',
end
% --- Executes on button press in pushbuttonContrastBrightness.
function pushbuttonContrastBrightness_
% hObject handle to pushbuttonContrastBrightness (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (handles.fileLoaded==1)
handles.RGB2 = changeBrightness(handles.RGB, get(handles.sliderBright, 'Value'), get(handles.sliderContrast, 'Value'));
axes(handles.axes2); imshow(handles.RGB2);
handles.fileLoaded2 = 1;
handles = updateHistograms(handles);
guidata(hObject, handles);
else
h = msgbox('No primary file has been loaded!','Error','error');
end
function handlesNew = updateHistograms(handles)
handlesNew = handles;
if (handles.fileLoaded == 1)
set(handles.textHist1, 'Visible', 'on');
axes(handlesNew.axesHist1);
cla;
ImageData1 = reshape(handlesNew.RGB(:,:,1), [size(handlesNew.RGB, 1) * size(handlesNew.RGB, 2) 1]);
ImageData2 = reshape(handlesNew.RGB(:,:,2), [size(handlesNew.RGB, 1) * size(handlesNew.RGB, 2) 1]);
ImageData3 = reshape(handlesNew.RGB(:,:,3), [size(handlesNew.RGB, 1) * size(handlesNew.RGB, 2) 1]);
[H1, X1] = hist(ImageData1, 1:5:256);
[H2, X2] = hist(ImageData2, 1:5:256);
[H3, X3] = hist(ImageData3, 1:5:256);
hold on;
plot(X1, H1, 'r');
plot(X2, H2, 'g');
plot(X3, H3, 'b');
axis([0 256 0 max([H1 H2 H3])]);
end
if (handlesNew.fileLoaded2 == 1)
set(handles.textHist2, 'Visible', 'on');
axes(handlesNew.axesHist2);
cla;
ImageData1
= reshape(handlesNew.RGB2(:,:,1)
ImageData2
= reshape(handlesNew.RGB2(:,:,2)
ImageData3
= reshape(handlesNew.RGB2(:,:,3)
[H1, X1] = hist(ImageData1, 1:5:256);
[H2, X2] = hist(ImageData2, 1:5:256);
[H3, X3] = hist(ImageData3, 1:5:256);
hold on;
plot(X1, H1, 'r');
plot(X2, H2, 'g');
plot(X3, H3, 'b');
axis([0 256 0 max([H1 H2 H3])]);
end
% --- Executes on button press in RotateButton.
function RotateButton_Callback(hObject, eventdata, handles)
% hObject handle to RotateButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.RGB2 = imrotate(handles.RGB, round(get(handles.
handles.fileLoaded = 1;
axes(handles.axes2); cla; imshow(handles.RGB2);
handles = updateHistograms(handles);
guidata(hObject, handles);
% --- Executes on slider movement.
function sliderRotate_Callback(hObject, eventdata, handles)
% hObject handle to sliderRotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
set(handles.editRotate,'
% --- Executes during object creation, after setting all properties.
function sliderRotate_CreateFcn(
% hObject handle to sliderRotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'
set(hObject,'BackgroundColor',
end
function editRotate_Callback(hObject, eventdata, handles)
% hObject handle to editRotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editRotate as text
%
str2double(get(hObject,'
% --- Executes during object creation, after setting all properties.
function editRotate_CreateFcn(hObject, eventdata, handles)
% hObject handle to editRotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'
set(hObject,'BackgroundColor',
end
Информация о работе Построение графического интерфейса в системе Matlab