Saving Live video input to avi file
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
I'm having trouble recording frames from a live video and saving each frame to a playable avi file. I get the error "Operands to the || and && operators must be convertible to logical scalar values."
I'm using Matlab 2018a version, and the video input is using a frame grabber device with serial and cameralink connection. 
% Specifies the Range of Interest 
if exist('ROI','var') % Becomes True if the ROI variable was assigned in the function
    CurROI = vid.ROIPosition; % Specifies Region of Interest(ROI) window
    vid.ROIPosition = [max(0,ROI(1)),max(0,ROI(2)),min(ROI(3),CurROI(3)),min(ROI(4),CurROI(4))]; % Creates boundaries for ROI  window
end
% Creates a video file from an array or file of images
diskLogger = VideoWriter(FileNameVideo,'Uncompressed AVI'); % VideoReader
diskLogger.FrameRate = 10; % Sets the framerate of the recorded and saved avi video file
set(vid,'Timeout',50);
% Starts the video
open(diskLogger);
preview(vid);
start(vid); % Triggers the acquisition of the live video
data = getdata(vid,vid.FramesAvailable,'uint8');
writeVideo(diskLogger,data)
implay(data);
%Close, stop, and end the video
close(diskLogger); % Closes the file the video was saved to 
stop(vid); % Stops the triggering of the live camera feed
stoppreview(vid)
I had an earlier version that showed the same error.
for ii = 1:numFrames % Loops through each frame of the live camera feed saved
    writeVideo(diskLogger, data(:,:,:,ii)); % writes each frame of the live feed to a video file 
end
This replaced the writevideo line. IF there is any solution to this, I need it as soon as possible. Any ideas?
7 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su National Instruments Frame Grabbers in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

