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!