2
저는 비디오의 일부 프레임으로 이동하는 것과 같이 비디오를 제어하기 위해 MATLAB GUI에서 슬라이더를 설정하려고합니다. 'obj'는 사용자가 선택한 비디오 파일입니다. 다음 코드는 입력 비디오를 가져 와서 GUI의 축에 표시하는 데 사용되었습니다.MATLAB GUI에서 비디오를 제어하기 위해 슬라이더를 어떻게 설정합니까?
global b
filename = get(handles.edit3, 'String');
if ~exist(filename, 'file')
warndlg('Text in edit box is not the name of a file');
return
end
try
obj = VideoReader(filename);
catch
warndlg('File named in edit box does not appear to be a usable movie file');
return
end
axes(handles.axes2)
handles.pushbutton5=0;
guidata(hObject,handles);
while ~(handles.pushbutton5)
if hasFrame(obj)
vidFrame = readFrame(obj);
obj;
image(vidFrame, 'Parent', handles.axes2);
set(axes, 'Visible', 'off');
pause(1/obj.FrameRate)
end
handles = guidata(hObject);
end
clear obj
슬라이더는 사용자가 슬라이더를 제어하는 동안 "b"값을 제공합니다.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (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
global b
b = get(handles.slider2,'Value');
아무도 비디오를 슬라이더로 제어 할 수 있도록이 문제를 해결하는 방법을 알고 있습니까?
당신이 명확하게 질문을 공식화하시기 바랍니다 수 있습니까? 동영상의 어떤 속성을 'b'값으로 제어 하시겠습니까? 프레임 인덱스 여야합니까? 재생 속도 또는 비디오 밝기? –
슬라이더를 사용하여 비디오의 여러 부분이나 프레임으로 이동하거나 이동해야합니다. –
비디오 프레임의 드로잉은'slider2_Callback' 함수에서 일어나야합니다. 비디오 파일에 액세스하고 인덱스 b로 프레임을 읽어야합니다. 데이터에 액세스하려면'guidata' 구조체에 위치 시키십시오. 변수'b'는 전역 변수 일 필요는 없습니다. 그렇다면 왜 matlab의 implay() 함수를 사용하지 않는가? https://de.mathworks.com/help/images/ref/implay.html –