Guest User

Untitled

a guest
Jul 11th, 2026
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.42 KB | None | 0 0
  1. v = VideoReader("only-human.mp4");
  2. frames = double(v.read([1 2]))/255;
  3.  
  4. a = frames(:,:,1,1);
  5. b = frames(:,:,1,2);
  6. h = size(a,1);
  7. N = 100;
  8. d = nan(N,1);
  9. for n=1:N
  10.     b2 = b(n:h,:);
  11.     a2 = a(1:(h-n+1),:);
  12.     c=abs(a2-b2);
  13.     d(n) = mean(c, [1 2]);
  14. end
  15.  
  16. [~, n_optimal] = min(d);
  17. b_optimal = b(n_optimal:h,:);
  18. a_optimal = a(1:(h-n_optimal+1),:);
  19. c_optimal = abs(a_optimal-b_optimal);
  20. figure
  21. imshow(c_optimal)
Advertisement
Add Comment
Please, Sign In to add comment