Assignment between unlike types is not allowed. Upsampling

4 visualizaciones (últimos 30 días)
Maaz Abdul Malik
Maaz Abdul Malik el 27 de Ag. de 2016
Respondida: Walter Roberson el 27 de Ag. de 2016
I am trying to up and downsample a video as an assignment. i can downsample it without a problem but while upsampling it all i get is this error. Alternatively i tried to use interp and resample functions but then i get "the arguments should be double"... Am i doing something wrong here?
clc;
clear all;
I=aviread('Car_video.avi');
obj=mmreader('Car_video.avi');
a=read(obj);
frames=get(obj,'numberofFrames');
for k=1: frames-1
I(k).cdata=a(:,:,:,k);
I(k).colormap =[];
end
%movie2avi(I,'car original.avi','compression','none','fps',30);
%d1=downsample(I,2);
%movie2avi(d1,'car downsample at 2.avi','compression','none','fps',30);
%d2=downsample(I,5);
%movie2avi(d2,'car downsample at 5.avi','compression','none','fps',30);
u=upsample(I,2);
movie2avi(u,'car upsample at 2.avi','compression','none','fps',30);
??? Assignment between unlike types is not allowed.
Error in ==> updownsample at 30
y(1:m*N*n) = 0; % Don't use zeros() because it doesn't support fi objects
Error in ==> upsample at 15
y = updownsample(x,N,'Up',varargin{:});

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de Ag. de 2016
You cannot pass frames to upsample() or downsample() : you have to pass signals.
It appears to me that upsample() and downsample() work along the first dimension of the data. It is not clear to me which dimension you want to resample along -- possibly the time dimension. If so then
u_a = permute( upsample( permute(a, [4 1 2 3]), 2 ), [2 3 4 1]);
and then break u_a down into frames.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by