필터 지우기
필터 지우기

How to generate .txt file including exposure time and timestamp ?

조회 수: 3 (최근 30일)
Ender Rencuzogullari
Ender Rencuzogullari 2018년 12월 25일
답변: Shivani Baldwa 2019년 9월 3일
Hi,
I am acquising video from image acquisition toolbox. Afterwards, I am splitting the video into frames starting from 00000.jpg to the last frame. My actual aim is to generate a .txt file which must consists of image-ID (00000.jpg), timestamp and exposure time (respectively as below). These data should be written into the file as number-of-images by 3. A sample visualization of the file is as below;
00000 1461161056.2800557613 3.6060349941
00001 1461161056.3000824451 3.6060349941
00002 1461161056.3200588226 3.6060349941
00003 1461161056.3400502205 3.6060349941
00004 1461161056.3600392342 3.6060349941
00005 1461161056.3800461292 3.6060349941
00006 1461161056.4000482559 3.6060349941
00007 1461161056.4200584888 3.6060349941
00008 1461161056.4400272369 3.6060349941
00009 1461161056.4600312710 3.6060349941
00010 1461161056.4800560474 3.6060349941
. . .
. . .
. . .
Splitting code is:
% Open an sample avi file
filename = 'C:\Users\Ender\Desktop\Example7.avi';
mov = VideoReader(filename);
% Output folder
outputFolder = fullfile(cd, 'frames7');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
%getting no of frames
numberOfFrames = mov.NumberOfFrames;
numberOfFramesWritten = 0;
for frame = 1 : numberOfFrames
thisFrame = read(mov, frame);
outputBaseFileName = sprintf('%3.5d.jpg', frame-1);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite(thisFrame, outputFullFileName, 'jpg');
progressIndication = sprintf('Wrote frame %4d of %d.', frame,numberOfFrames);
fprintf(progressIndication);
numberOfFramesWritten = numberOfFramesWritten + 1;
end
progressIndication = sprintf('Wrote %d frames to folder "%s"',numberOfFramesWritten, outputFolder);
disp(progressIndication);
How can I obtain such .txt file ?
  댓글 수: 2
Rik
Rik 2018년 12월 25일
If you can obtain the requiered values inside the loop, it is trivial to write it to a text file with fprintf.
Ender Rencuzogullari
Ender Rencuzogullari 2018년 12월 25일
편집: Ender Rencuzogullari 2018년 12월 25일
That's the problem that I cannot figue out. How can I obtain these values ? I could not find any way to do that with matlab functions.

댓글을 달려면 로그인하십시오.

답변 (1개)

Shivani Baldwa
Shivani Baldwa 2019년 9월 3일
@Ender Rencuzogullari how to make times.txt file can you just guide me ?

제품


릴리스

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by