Considering all video frames of a video in time ( t
) as volume, I have to decompose them into set of 2d slices in time ie I(x,t)
(Slice volume along x and t) and I(y,t)
(slice volume along y and t). How can I achieve this in matlab? I am not able to figure out how to do this slicing?
Edit: Code so far
vid='Orca vs Great White Shark.avi';
vidobj=mmreader(vid);
numofframes=get(vidobj,'numberOfFrames');
disp(numofframes);
for i=1:25:numofframes
vidframe=read(vidobj,i);
end
for k=1:numofframes
mov(k).cdata = read(vidobj,k);
end
So far I have read the video and saved the frames in vidframes. How do I proceed?
Here's an example:
A = rand(3,3,3)
Terminal:
A(:,:,1) =
0.8147 0.9134 0.2785
0.9058 0.6324 0.5469
0.1270 0.0975 0.9575
A(:,:,2) =
0.9649 0.9572 0.1419
0.1576 0.4854 0.4218
0.9706 0.8003 0.9157
A(:,:,3) =
0.7922 0.0357 0.6787
0.9595 0.8491 0.7577
0.6557 0.9340 0.7431
Now I assume the 3rd dimension is time. To get a slice you need to use the squeeze function:
squeeze(A(1,:,:))'
terminal:
ans =
0.8147 0.9134 0.2785
0.9649 0.9572 0.1419
0.7922 0.0357 0.6787
squeeze(A(:,1,:)) will give the first column in time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.