MATLAB: Convert Video Frames to Images

license plate recognitionvideo frame to image conversionvideo processingvideoreader/set

Good Day!
I am trying to convert video frames to images and consequently process those images for character recognition. I found the code here and it goes this way
% Video to Frame Convertion
file=VideoReader(filename);
filename= (filename); % to get inforamtaion abt video file
frm_cnt = file.NumberOfFrames; % No.of frames in the video file
h = waitbar(0,'Please wait...');
font = '.bmp';
for i=1:frm_cnt
frm(i) = VideoReader(filename,i); % read the Video file
RGBimg = frame2im(frm(i)); % Convert Frame to image file
strNmae = num2str(i);
writeName = strcat(strNmae,font);
% imwrite(RGBimg,writeName);
%figure(1), imshow(RGBimg); % Color Image
grayImg = rgb2gray(RGBimg); %convert gray
% figure(2), imshow(grayImg);
% median filter is applied for smoothing and unwanted noise removal
grayImg = medfilt2(grayImg,[3 3]);
% dynamic thresholding is appiled
grayImg = adapthisteq(grayImg);
% figure(3), imshow(grayImg);
c
the error message goes like this
% Error using VideoReader/set Invalid input argument type to 'set'. Type 'help set' for options. Error in VideoReader (line 176) set(obj, varargin{:}); Error in LPRmain (line 69) frm(i) = VideoReader(filename,i); % read the Video file
Can anyone please help me how to remove this error? TIA!

Best Answer

I do that in my attached demo. See how I extract the frames and write them to disk.