📄 deinterlacing.m
字号:
I6 = imresize(I6,[iry irx],'bicubic');
I5 = I5(2:iry,:,:);
I6 = I6(1:iry-1,:,:);
for i=1:liy
I7(i,:,:) = Fd(2*i-1,:,:);
I8(i,:,:) = Fd(2*i,:,:);
end
I7 = imresize(I7,[iry irx],'bicubic');
I8 = imresize(I8,[iry irx],'bicubic');
I7 = I7(2:iry,:,:);
I8 = I8(1:iry-1,:,:);
handles.F(1,8*(k-st+1)-7) = im2frame(I1);
handles.F(1,8*(k-st+1)-6) = im2frame(I3);
handles.F(1,8*(k-st+1)-5) = im2frame(I5);
handles.F(1,8*(k-st+1)-4) = im2frame(I7);
handles.F(1,8*(k-st+1)-3) = im2frame(I2);
handles.F(1,8*(k-st+1)-2) = im2frame(I4);
handles.F(1,8*(k-st+1)-1) = im2frame(I6);
handles.F(1,8*(k-st+1)-0) = im2frame(I8);
end
guidata(hObject, handles);
disp('------------------------------------------------')
disp('The Deinterlacing process Completed Successfully')
end
close(h)
end
function ULCX_Callback(hObject, eventdata, handles)
% hObject handle to ULCX (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 ULCX as text
% str2double(get(hObject,'String')) returns contents of ULCX as a double
% --- Executes during object creation, after setting all properties.
function ULCX_CreateFcn(hObject, eventdata, handles)
% hObject handle to ULCX (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
% --- Executes during object creation, after setting all properties.
function Frame_NO_CreateFcn(hObject, eventdata, handles)
% hObject handle to Frame_NO (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
% --- Executes during object creation, after setting all properties.
function ULCY_CreateFcn(hObject, eventdata, handles)
% hObject handle to ULCY (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
% --- Executes during object creation, after setting all properties.
function LRCX_CreateFcn(hObject, eventdata, handles)
% hObject handle to LRCX (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
% --- Executes during object creation, after setting all properties.
function LRCY_CreateFcn(hObject, eventdata, handles)
% hObject handle to LRCY (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
% --- Executes on button press in By_Mouse.
function By_Mouse_Callback(hObject, eventdata, handles)
% hObject handle to By_Mouse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
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')
%x = [p1(1) p1(1)+offset(1) p1(1)+offset(1) p1(1) p1(1)];
%y = [p1(2) p1(2) p1(2)+offset(2) p1(2)+offset(2) p1(2)];
handles.x = fix(p1(1));
handles.y = fix(p1(2));
handles.w = fix(offset(1));
handles.h = fix(offset(2));
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')
ux = handles.x;
uy = handles.y;
lx = handles.w + handles.x;
ly = handles.h + handles.y;
set(handles.ULCX,'String',ux);
set(handles.ULCY,'String',uy);
set(handles.LRCX,'String',lx);
set(handles.LRCY,'String',ly);
% Update handles structure
guidata(hObject, handles);
% --------------------------------------------------------------------
function File_menu_Callback(hObject, eventdata, handles)
% hObject handle to File_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function import_workspace_Callback(hObject, eventdata, handles)
% hObject handle to import_workspace (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc;
disp(' please wait ... ');
disp(' Loading data from Workspace ... ');
handles.mov = evalin('base','F');
handles.nof = max(size(handles.mov));
handles.n = handles.nof;
set(handles.slider1,'SliderStep',[1/handles.nof;.1])
set(handles.slider1,'Value',1);
set(handles.Frame_NO,'String',handles.n);
[I,Map] = frame2im(handles.mov(1,handles.n));
image(I)
disp(' Loading Process completed ');
guidata(hObject, handles);
% --------------------------------------------------------------------
function Open_menu_Callback(hObject, eventdata, handles)
% hObject handle to Open_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile('*.avi', 'Pick an avi-file');
if isequal(filename,0)
disp('User selected Cancel')
else
file = fullfile(pathname, filename)
disp(['User selected', file])
handles.mov = aviread(file);
handles.nof = max(size(handles.mov));
handles.n = handles.nof;
set(handles.slider1,'Value',1);
set(handles.Frame_NO,'String',handles.n);
[I,Map] = frame2im(handles.mov(1,handles.n));
axes(handles.axes1);
image(I)
sz = size(I);
handles.x = 1;
handles.y = 1;
handles.w = sz(1,2) - 1;
handles.h = sz(1,1) - 1;
ux = handles.x;
uy = handles.y;
lx = handles.w + handles.x;
ly = handles.h + handles.y;
set(handles.ULCX,'String',ux);
set(handles.ULCY,'String',uy);
set(handles.LRCX,'String',lx);
set(handles.LRCY,'String',ly);
set(handles.slider1,'SliderStep',[1/handles.nof;.1])
guidata(hObject, handles);
end
% --------------------------------------------------------------------
function Save_menu_Callback(hObject, eventdata, handles)
% hObject handle to Save_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uiputfile('*.avi', 'Save As...');
if isequal(filename,0) | isequal(pathname,0)
disp('User selected Cancel')
else
file = fullfile(pathname,filename);
disp(['User selected: ',file])
movie2avi(handles.F,file,'fps',25,'compression','Indeo5');
end
% --------------------------------------------------------------------
function Export_menu_Callback(hObject, eventdata, handles)
% hObject handle to Export_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Exit_menu_Callback(hObject, eventdata, handles)
% hObject handle to Exit_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close
% --------------------------------------------------------------------
function Contents_menu_Callback(hObject, eventdata, handles)
% hObject handle to Contents_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%HelpPath = which('deinter.html')
%web(HelpPath);
uiopen('D:\MATLAB701\work\deinter.htm',1)
% --------------------------------------------------------------------
function About_menu_Callback(hObject, eventdata, handles)
% hObject handle to About_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
str = sprintf(['Human Motion Tracer - Deinterlacing 1.1.1\n\n',...
'Sharif University of Technology\n',...
'Mechanical Engineering Department\n\n',...
'Copyright 2004-2006 The Microjects, Inc.\n']);
msgbox(str,'About the Human Motion Tracer','modal');
% --------------------------------------------------------------------
function Help_menu_Callback(hObject, eventdata, handles)
% hObject handle to Help_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -