clear all; close all; clc; load highway.mat k = 5; [n,d] = size(X); model = dimRedRPCA(X,k); Z = model.compress(model,X); Xhat = model.expand(model,Z); loops = 30; F(loops) = struct('cdata',[],'colormap',[]); for i = 1:loops image = [reshape(X(i,:),[64 64]) reshape(Xhat(i,:),[64 64]) ... reshape(255*(abs(X(i,:)-Xhat(i,:))>10),[64 64])]; imagesc(image);colormap gray F(i) = getframe; %pause(0.2) end movie(F,2)
the left image is a video of a higway. The middle is the same video with residue removal. The right one shows the residues.