Mercurial > hg > ishara
view sequences/+seq/subsampler.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 9e7be347b3a0 |
children |
line wrap: on
line source
% subsampler - keep every N values from a sequence % % subsampler :: % natural ~ sample rate, % seq(A), ~ source seq, % ... ~ options) % -> seq(A). classdef subsampler < seq properties (GetAccess=private, SetAccess=private) source n end methods function d=subsampler(a,s), d.n=a; d.source=s; end function s=tostring(d), s=sprintf('%s >> subsample(%d)',tostring(d.source),tostring(d.n)); end function z=elsize(o), o=size(head(o)); end function x=head(d), x=head(d.source); end function o=next(o) for i=1:o.n o.source=next(o.source); if isempty(o.source), o=nil; break; end end end end end