Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- v = VideoReader("only-human.mp4");
- frames = double(v.read([1 2]))/255;
- a = frames(:,:,1,1);
- b = frames(:,:,1,2);
- h = size(a,1);
- N = 100;
- d = nan(N,1);
- for n=1:N
- b2 = b(n:h,:);
- a2 = a(1:(h-n+1),:);
- c=abs(a2-b2);
- d(n) = mean(c, [1 2]);
- end
- [~, n_optimal] = min(d);
- b_optimal = b(n_optimal:h,:);
- a_optimal = a(1:(h-n_optimal+1),:);
- c_optimal = abs(a_optimal-b_optimal);
- figure
- imshow(c_optimal)
Advertisement
Add Comment
Please, Sign In to add comment