How to store data from iterative processes?
2 次查看(过去 30 天)
显示 更早的评论
I want to store the results from an iterative video processing, which means I am getting data from every single frame on the video.
I am calculating depth estimation from an stereo video, I am calculating:
- Frame
- Time (video time)
- Target World Coordinates (X, Y, Z), where this is a m x 3 matrix
- ... Among others ...
All this variables are gonna change at every single instant of time, let's say:
- Frame will increase for every iteration, i.e. Frame = Frame + 1;
- Time will read the instant of time of the video which belongs to the frame beign process, i.e. 1 seg;
- Coordinates, where it will store the world coordinates of the targets, i. e, [2 4 5 ; 1 8 9];
For example:
Frame = 0; % Frame reader
Time = 0; % Time reader
Coordinates = zeros(m , 3) % World Coordinates
while hasFrame(Video)
Frame = Frame + 1; % Increase the counter for the Frames
% {
% This Section contains all the video processing
% }
Coordinates = [X1 Y1 Z1
X2 Y2 Z2
X3 Y3 Z3
...
Xn Yn Zn]; % This will return the world coordinates of the targets that are in the video, this might change in size of rows...
end
I want to store each of the variables avobe in a single object with the following (or similar) format as a class or something.
Frame(1).Time; % Whatever time is on the video
Frame(1).Coordinates; % Results from the processing
Frame(2).Time; % Whatever time is on the video
Frame(2).Coordinates; % Results from the processing
Is there a way I can achieve what I want?
0 个评论
回答(1 个)
Ashutosh Prasad
2018-11-15
You can create structure array in each iteration and add the fields 'Time' and 'Coordinates' for each frame.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!