www.pudn.com > tuxiangjiaozheng.rar > color_correction.m, change:2013-01-15,size:6291b


function varargout = color_correction(varargin)
% COLOR_CORRECTION MATLAB code for color_correction.fig
%      COLOR_CORRECTION, by itself, creates a new COLOR_CORRECTION or raises the existing
%      singleton*.
%
%      H = COLOR_CORRECTION returns the handle to a new COLOR_CORRECTION or the handle to
%      the existing singleton*.
%
%      COLOR_CORRECTION('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in COLOR_CORRECTION.M with the given input arguments.
%
%      COLOR_CORRECTION('Property','Value',...) creates a new COLOR_CORRECTION or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before color_correction_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to color_correction_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help color_correction

% Last Modified by GUIDE v2.5 14-Jan-2013 18:43:11

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @color_correction_OpeningFcn, ...
                   'gui_OutputFcn',  @color_correction_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before color_correction is made visible.
function color_correction_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to color_correction (see VARARGIN)
h_MainDemo = findobj( 'Tag' , 'figure_guidemo' );
h_MainDemo = guihandles( h_MainDemo );
setappdata( handles.color_ui , 'h_pDemo' , h_MainDemo );
% Choose default command line output for color_correction
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes color_correction wait for user response (see UIRESUME)
% uiwait(handles.color_ui);


% --- Outputs from this function are returned to the command line.
function varargout = color_correction_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on slider movement.
function slider_color_1_Callback(hObject, eventdata, handles)
% hObject    handle to slider_color_1 (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
val = get( hObject, 'Value');
set( handles.val_1_txt , 'String' ,  num2str(val));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h_pdemo = getappdata( handles.color_ui , 'h_pDemo');
axes( h_pdemo.axes_dst );
img_src = getappdata( h_pdemo.figure_guidemo, 'img_data');
%bw = im2bw( img_src , val/100);
img_src(:,:,1) = img_src(:,:,1)+val;%R
imshow(img_src);

% --- Executes during object creation, after setting all properties.
function slider_color_1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_color_1 (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,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider_color_2_Callback(hObject, eventdata, handles)
% hObject    handle to slider_color_2 (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


% --- Executes during object creation, after setting all properties.
function slider_color_2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_color_2 (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,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on slider movement.
function slider_color_3_Callback(hObject, eventdata, handles)
% hObject    handle to slider_color_3 (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


% --- Executes during object creation, after setting all properties.
function slider_color_3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider_color_3 (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,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end