How can I write the results of my 'Video OCR' script to an excel document in the following format?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Dima Lisin
2015-2-8
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 个评论
ayesha abbassi
2018-3-13
thank you man... (y) this helps me..
1 个评论
ayça kepçe
2019-7-3
Hi there, I am stuck with the same thing but csvwrite does not except ocrtext. Can you give a small example?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!