Video downsampling loop taking too long
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hey guys,
I just re-tooled a loop I use to downsample movies. I used to just downsample in one spatial dimension, and am now downsampling in two spatial dimensions as well as in time, so I'm puzzled as to why this is now taking forever where it didn't used to. I'm hoping there's something stupid I am doing in the loop that I can't see...
    % spatial downsample, factor of two
    ds_factor  = 2;
    MovieInfo.ds_factor = ds_factor;
    % temporal downsample to 15 Hz
    ds_factor2 = Vid.FrameRate / 15;
    MovieInfo.ds_factor12 = ds_factor2;
    imageData = double(read(Vid,1));
    %frame_ds  = downsample(imageData,ds_factor);
    mov       = zeros(size(imageData,1)/ds_factor,size(imageData,2)/ds_factor, ...
                      length(2:ds_factor2:nFrames));
    tic
    multiWaitbar('Extracting video frames...',0);
    count = 0;
    for frame = 2:ds_factor2:nFrames
        count = count + 1;
        imageData = double(read(Vid,frame));
        %downsample
        Ds = downsample(imageData(:,:,1),ds_factor); 
        Ds = Ds(:,1:size(Ds,2)/size(mov,2):end);
        mov(:,:,count) = Ds;
        %mov(:,:,frame) = downsample(imageData(:,:,1),ds_factor);                                       
        multiWaitbar('Extracting video frames...', count/length(2:ds_factor2:nFrames));
    end
    multiWaitbar('Extracting video frames...', 'Close');
    toc
0 comentarios
Respuestas (0)
Ver también
Categorías
				Más información sobre Multirate Signal Processing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
