hi, i want to convert a video into grayscale, but it keeps giving me an error, specifically a "parse_input" error
my code:
%Create a multimedia reader video
readerobj = VideoReader('yourvideo.mp4', 'tag', 'myreader1');readerobj.Width readerobj.Height% Read in all video frames.
vidFrames = read(readerobj);% Get the number of frames.
numFrames = get(readerobj, 'NumberOfFrames');%creat an output video file
v = VideoWriter('peaks.avi');%Set the output video framerate to the input frame rate
v.FrameRate = readerobj.FrameRate;open(v);% Create a MATLAB movie struct from the video frames.
for k = 1 : numFrames %get a frame from the video
frame=vidFrames(:,:,:,k); frame = rgb2gray(frame); %write the frame to the output video file
writeVideo(v,frame); %add the frame to a movie object
mov(k).cdata = frame; mov(k).colormap = []; %if you want to save the frame
%Create Filename to store
end%close the output video file. This will finish writing he video file
close(v);% Create a figure
hf = figure; % Resize figure based on the video's width and height
set(hf, 'position', [150 150 readerobj.Width readerobj.Height])% Playback movie once at the video's frame rate
movie(hf, mov, 1, readerobj.FrameRate);
Best Answer