GameShop PL

Wymień swoje gry na inne/ zarób i miej zabawę.

Ogłoszenie

Szybka i sprawna wymiana gier.

#1 2012-03-06 19:13:31

asd

Gość

asd

Kod:

function varargout = przeksztalcenia(varargin)
% PRZEKSZTALCENIA MATLAB code for przeksztalcenia.fig
%      PRZEKSZTALCENIA, by itself, creates a new PRZEKSZTALCENIA or raises the existing
%      singleton*.
%
%      H = PRZEKSZTALCENIA returns the handle to a new PRZEKSZTALCENIA or the handle to
%      the existing singleton*.
%
%      PRZEKSZTALCENIA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PRZEKSZTALCENIA.M with the given input arguments.
%
%      PRZEKSZTALCENIA('Property','Value',...) creates a new PRZEKSZTALCENIA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before przeksztalcenia_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to przeksztalcenia_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 przeksztalcenia

% Last Modified by GUIDE v2.5 06-Mar-2012 18:59:40

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @przeksztalcenia_OpeningFcn, ...
                   'gui_OutputFcn',  @przeksztalcenia_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 przeksztalcenia is made visible.
function przeksztalcenia_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 przeksztalcenia (see VARARGIN)

% Choose default command line output for przeksztalcenia
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes przeksztalcenia wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = przeksztalcenia_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 button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

FSrcImage = handles.FSrcImage;
FOutImage = double(FSrcImage);
w = ones(3,3);
im_list = get(handles.listbox2,'String');
filter = im_list(get(handles.listbox2,'Value'));
if strcmp(filter,'konwulencyjny')
    w(1,1)=str2double(get(handles.edit1,'String'));
    w(1,2)=str2double(get(handles.edit2,'String'));
    w(1,3)=str2double(get(handles.edit3,'String'));
    w(2,1)=str2double(get(handles.edit4,'String'));
    w(2,2)=str2double(get(handles.edit5,'String'));
    w(2,3)=str2double(get(handles.edit6,'String'));
    w(3,1)=str2double(get(handles.edit7,'String'));
    w(3,2)=str2double(get(handles.edit8,'String'));
    w(3,3)=str2double(get(handles.edit9,'String'));
    
    P = 0;
    for u=1:size(w,1)
        for v=1:size(w,2)
            P=P+w(u,v)*double(FSrcImage(i+u-2,j+v-2));
        end;
    end;
    FOutImage(i,j)=P;
end;
end;
Min=min(min(FOutImage));
Max=max(max(FOutImage));
SrcMax=double(max(max(FSrcImage)));
FOutImage=floor(FOutImage-min)/(Max-min)*srcMax);
else
    for i=2:size(FOutImage,1)-1
        for j=2:size(FOutImage,2)-1
            for u=1:size(w,1)
                for v=1:size(w,2)
                    w(u,v)=FSrcImage(i+u-2,j+v-2);
                end;
            end;
            sw=sort(w(:));
            if strcmp(filter,'medianowy')
                P=sw(5);
            end;
            if strcmp(filter,'max')
                P=sw(9);
            end;
            if strcmp(filter,'min')
                P=sw(1);
            end;
            if strcmp(filter,'max-min')
                P=sw(9)-sw(1);
            end;
            FOutImage(i,j)=P;
        end;
    end;
end;
axes(handles.axes2);
image(FOutImage);


    


% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1
im_list

% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in listbox2.
function listbox2_Callback(hObject, eventdata, handles)
% hObject    handle to listbox2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox2 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox2


% --- Executes during object creation, after setting all properties.
function listbox2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


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



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


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



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


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



function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


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



function edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (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 edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double


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



function edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (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 edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


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



function edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (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 edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double


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



function edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (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 edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double


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



function edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (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 edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double


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

#2 2012-03-06 19:25:46

rgs

Gość

Re: asd

% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

FSrcImage = handles.FSrcImage;
FOutImage = double(FSrcImage);
w = ones(3,3);
im_list = get(handles.listbox2,'String');
filter = im_list(get(handles.listbox2,'Value'));
if strcmp(filter,'konwulencyjny')
    w(1,1)=str2double(get(handles.edit1,'String'));
    w(1,2)=str2double(get(handles.edit2,'String'));
    w(1,3)=str2double(get(handles.edit3,'String'));
    w(2,1)=str2double(get(handles.edit4,'String'));
    w(2,2)=str2double(get(handles.edit5,'String'));
    w(2,3)=str2double(get(handles.edit6,'String'));
    w(3,1)=str2double(get(handles.edit7,'String'));
    w(3,2)=str2double(get(handles.edit8,'String'));
    w(3,3)=str2double(get(handles.edit9,'String'));
   
    P = 0;
    for u=1:size(w,1)
        for v=1:size(w,2)
            P=P+w(u,v)*double(FSrcImage(i+u-2,j+v-2));
        end;
    end;
    FOutImage(i,j)=P;
end;
end;
Min=min(min(FOutImage));
Max=max(max(FOutImage));
SrcMax=double(max(max(FSrcImage)));
FOutImage=floor(FOutImage-min)/(Max-min)*srcMax);
else
    for i=2:size(FOutImage,1)-1
        for j=2:size(FOutImage,2)-1
            for u=1:size(w,1)
                for v=1:size(w,2)
                    w(u,v)=FSrcImage(i+u-2,j+v-2);
                end;
            end;
            sw=sort(w(:));
            if strcmp(filter,'medianowy')
                P=sw(5);
            end;
            if strcmp(filter,'max')
                P=sw(9);
            end;
            if strcmp(filter,'min')
                P=sw(1);
            end;
            if strcmp(filter,'max-min')
                P=sw(9)-sw(1);
            end;
            FOutImage(i,j)=P;
        end;
    end;
end;
axes(handles.axes2);
image(FOutImage);


% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Hints: contents = get(hObject,'Strings') returns listbox1 contents as cell array
%    contents{get(hObject,'Value')}returns selected itemfrom listbox1
im_list= get(hObject,'String');
im_path= im_list(get(hObject,'Value'));
FSrcImage = imread(char(im_path));
if (ndims(FSrcImage)==3)
FSrcImage=rgb2ind(FSrcImage,gray(255));
end;
axes(handles.axes1);
colormap(gray(255));
image(FSrcImage);
handles.FSrcImage = FSrcImage;
guidata(hObject,handles);

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
GotLink.plWładysławowo wakacje wynajem podnośnika koszowego wrocław