필터 지우기
필터 지우기

How to record a clip for the right and left eye and convert it into a frame

조회 수: 2 (최근 30일)
Hello, I am trying to record a video clip for each eye and turn them into pictures, but I am stuck in the issues of reversing directions during filming, and I tried a lot to add a detection code, but there is still an error, how can I modify the code so that I can at least record clips for all eyes only
%% Take a video from the camera
detector = vision.CascadeObjectDetector(); % Create a detector for face using Viola-Jones
detector1 = vision.CascadeObjectDetector('EyePairSmall'); %create detector for eyepair
video_source = videoinput('winvideo',1,"MJPG_640x480");
set(video_source,'ReturnedColorSpace','gray');
%Code to display the dimensions of the camera in real time
preview(video_source);
%img = flip(vid, 2);
% Create an subjectect to write a file
writer = VideoWriter(subject,'Motion JPEG AVI');
% of the movie duration is calculated by the number of frames per second
% over the total of the frames, but does not specify a duration camera
% recording, but determines the duration of the video clip
% writer.FrameRate/length FR/totalF or FR/L
%T=L/FR RTR=2T
writer.FrameRate = 5.0; length = 150;
% video file in MATLAB is actually a composite structure that has two
% parts, These two parts, one is the gradient colormap, the other is the
% video data content
file.colormap=[];
% Open the subjectect and start recording
open(writer);
% video_source=flip(video_source,2);
for i=1:length
frame = getsnapshot(video_source1);
file.cdata = frame;
writeVideo(writer,file);
end
% It is a good habit to stop all things at hand
close(writer);
closepreview;
delete(video_source);

답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by