Assignment between unlike types is not allowed. Upsampling
4 次查看(过去 30 天)
显示 更早的评论
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{:});
0 个评论
回答(1 个)
Walter Roberson
2016-8-27
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!