⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deinterlacing.m

📁 去隔行处理的matlab源程序
💻 M
📖 第 1 页 / 共 3 页
字号:
function varargout = Deinterlacing(varargin)

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Deinterlacing_OpeningFcn, ...
    'gui_OutputFcn',  @Deinterlacing_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 Deinterlacing is made visible.
function Deinterlacing_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 Deinterlacing (see VARARGIN)
%plot(mov,mov)
% Choose default command line output for Deinterlacing
handles.output = hObject;
handles.pop = 0;
handles.x = 1;
handles.y = 1;
handles.w = 1;
handles.h = 1;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Deinterlacing_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 slider1_Callback(hObject, eventdata, handles)
% hObject    handle to slider1 (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
sv = get(handles.slider1,'Value');
handles.n=round(sv*max(size(handles.mov)));
if handles.n ==0, handles.n=1,end
set(handles.Frame_NO,'String',handles.n);
axes(handles.axes1);
[I,Map] = frame2im(handles.mov(1,handles.n));
image(I)
axes(handles.axes1)
rectangle('Position',[handles.x,handles.y,handles.w,handles.h],'Curvature',[0.2,0.2],'EdgeColor','r')
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to slider1 (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 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 on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (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,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
val = get(handles.popupmenu1,'Value');
switch val
    case 1
        handles.pop = 1;
    case {2,3}
        handles.pop = 2;
        disp('In the second image select an area that cover your previous selected area of first image')
        disp('----------------------------------------------------------------------------------------')
        set(Deinterlacing,'Pointer','fullcrosshair')
        k = waitforbuttonpress;
        point1 = get(gca,'CurrentPoint');    % button down detected
        finalRect = rbbox;                   % return figure units
        point2 = get(gca,'CurrentPoint');    % button up detected
        point1 = point1(1,1:2);              % extract x and y
        point2 = point2(1,1:2);
        p1 = min(point1,point2);             % calculate locations
        offset = abs(point1-point2);         % and dimensions
        set(Deinterlacing,'Pointer','arrow')
        x1 = fix(p1(1));
        y1 = fix(p1(2));
        x2 = fix(offset(1))+x1;
        y2 = fix(offset(2))+y1;
        [I,Map] = frame2im(handles.mov(1,1));
        s = size(I)
        if y2>s(1), y2=s(1), end;
        if x2>s(2), x2=s(2), end;

        axes(handles.axes1)
        rectangle('Position',[x1,y1,x2-x1,y2-y1],'Curvature',[0.2,0.2],'EdgeColor','r')
        handles.x11 = x1;
        handles.y11 = y1;
        handles.x21 = x2;
        handles.y21 = y2;

        guidata(hObject, handles);

        %     case 3
        %         handles.pop = 3;
        %         k = waitforbuttonpress;
        %         point1 = get(gca,'CurrentPoint');    % button down detected
        %         finalRect = rbbox;                   % return figure units
        %         point2 = get(gca,'CurrentPoint');    % button up detected
        %         point1 = point1(1,1:2);              % extract x and y
        %         point2 = point2(1,1:2);
        %         p1 = min(point1,point2);             % calculate locations
        %         offset = abs(point1-point2);         % and dimensions
        %         x1 = fix(p1(1));
        %         y1 = fix(p1(2));
        %         x2 = fix(offset(1))+x1;
        %         y2 = fix(offset(2))+y1;
        %         [I,Map] = frame2im(handles.mov(1,1));
        %         s = size(I)
        %         if y2>s(1), y2=s(1), end;
        %         if x2>s(2), x2=s(2), end;
        %
        %         axes(handles.axes1)
        %         rectangle('Position',[x1,y1,x2-x1,y2-y1],'Curvature',[0.2,0.2],'EdgeColor','r')
        %         handles.x11 = x1;
        %         handles.y11 = y1;
        %         handles.x21 = x2;
        %         handles.y21 = y2;
        %
        %         guidata(hObject, handles);
        %
    case 4
        handles.pop = 4;
        set(Deinterlacing,'Pointer','fullcrosshair')
        k = waitforbuttonpress;
        point1 = get(gca,'CurrentPoint');    % button down detected
        finalRect = rbbox;                   % return figure units
        point2 = get(gca,'CurrentPoint');    % button up detected
        point1 = point1(1,1:2);              % extract x and y
        point2 = point2(1,1:2);
        p1 = min(point1,point2);             % calculate locations
        offset = abs(point1-point2);         % and dimensions
        set(Deinterlacing,'Pointer','arrow')
        x1 = fix(p1(1));
        y1 = fix(p1(2));
        x2 = fix(offset(1))+x1;
        y2 = fix(offset(2))+y1;
        [I,Map] = frame2im(handles.mov(1,1));
        s = size(I)
        if y2>s(1), y2=s(1), end;
        if x2>s(2), x2=s(2), end;

        axes(handles.axes1)
        rectangle('Position',[x1,y1,x2-x1,y2-y1],'Curvature',[0.2,0.2],'EdgeColor','r')
        handles.x11 = x1;
        handles.y11 = y1;
        handles.x21 = x2;
        handles.y21 = y2;
        %***********************
        k = waitforbuttonpress;
        point1 = get(gca,'CurrentPoint');    % button down detected
        finalRect = rbbox;                   % return figure units
        point2 = get(gca,'CurrentPoint');    % button up detected
        point1 = point1(1,1:2);              % extract x and y
        point2 = point2(1,1:2);
        p1 = min(point1,point2);             % calculate locations
        offset = abs(point1-point2);         % and dimensions
        x1 = fix(p1(1));
        y1 = fix(p1(2));
        x2 = fix(offset(1))+x1;
        y2 = fix(offset(2))+y1;
        [I,Map] = frame2im(handles.mov(1,1));
        s = size(I)
        if y2>s(1), y2=s(1), end;
        if x2>s(2), x2=s(2), end;

        axes(handles.axes1)
        rectangle('Position',[x1,y1,x2-x1,y2-y1],'Curvature',[0.2,0.2],'EdgeColor','r')
        handles.x12 = x1;
        handles.y12 = y1;
        handles.x22 = x2;
        handles.y22 = y2;
        %**************************
        k = waitforbuttonpress;
        point1 = get(gca,'CurrentPoint');    % button down detected
        finalRect = rbbox;                   % return figure units
        point2 = get(gca,'CurrentPoint');    % button up detected
        point1 = point1(1,1:2);              % extract x and y
        point2 = point2(1,1:2);
        p1 = min(point1,point2);             % calculate locations
        offset = abs(point1-point2);         % and dimensions
        x1 = fix(p1(1));
        y1 = fix(p1(2));
        x2 = fix(offset(1))+x1;
        y2 = fix(offset(2))+y1;
        [I,Map] = frame2im(handles.mov(1,1));
        s = size(I)
        if y2>s(1), y2=s(1), end;
        if x2>s(2), x2=s(2), end;

        axes(handles.axes1)
        rectangle('Position',[x1,y1,x2-x1,y2-y1],'Curvature',[0.2,0.2],'EdgeColor','r')
        handles.x13 = x1;
        handles.y13 = y1;
        handles.x23 = x2;
        handles.y23 = y2;
        guidata(hObject, handles);


end
clc
popup = handles.pop
guidata(hObject, handles);

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

% Hint: popupmenu 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


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -