How can I write the results of my 'Video OCR' script to an excel document in the following format?
4 views (last 30 days)
Show older comments
Good Afternoon, I'm attempting to write a script that will
- Break up a video into its component frames (Check)
- Use the OCR function (computer vision toolbox) to find text in each of these frames (Check)
- write this text to an excel document (this is where I am experiencing difficulty)
So for the sake of this question lets say that I am simply trying to write a script that will read names from the bottom of say a CNN video. I would have a series of names as such (John Doe firm x, Jane Doe firm y,...) and would like this written in an excel spreadsheet under column A(A1,A2,A3,...). Thus far I have only been able to have Matlab write the first frames recognized characters to excel which each character taking up its own column. Below I have copied my script thus far and additionally inserted a screenshot of my resultant excel file:
clear all
close all
clc
vid=VideoReader('/Users/me/Documents/MATLAB/Video 2.mp4');
nFrames = vid.NumberOfFrames;
roi=[7 595 1273 93];
for f = 1:7
frame=read(vid,f);
ocrResults(f) = ocr(frame,roi);
end
Text=ocrResults.Text
filename = 'textResults.xls';
xlswrite(filename,Text)
Any help would be greatly appreciated.
0 Comments
Answers (2)
Dima Lisin
on 8 Feb 2015
You can write your output into a .csv (comma-separated values) file using the csvwrite function. Excell can read a .csv file, and it will put every comma-delimited item into its own cell.
0 Comments
ayesha abbassi
on 13 Mar 2018
thank you man... (y) this helps me..
1 Comment
ayça kepçe
on 3 Jul 2019
Hi there, I am stuck with the same thing but csvwrite does not except ocrtext. Can you give a small example?
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!