[英]Converting dimension of array in Matlab
As with my previous question: 就像我之前的问题一样:
I am using this function I got from the internet:
我正在使用从互联网获得的此功能:
>>[Y,U,V]=yuv_import('test.yuv',[176 144],150,0)
I got this from: [Convert YUV CIF 4:2:0 video file to image files][1]
我从以下网站获得此信息:[将YUV CIF 4:2:0视频文件转换为图像文件] [1]
It prints out the Y, U and V components of the yuv file test.yuv.
它打印出yuv文件test.yuv的Y,U和V分量。 When I typed:
当我输入时:
>>Y
It displayed:
它显示:
Y = Columns 1 through 5 [144x176 double] [144x176 double] [144x176 double] [144x176 double] [144x176 double] ............... Columns 146 through 150 [144x176 double] [144x176 double] [144x176 double] [144x176 double] [144x176 double]
And..
和..
>>size(Y)
displayed:
显示:
ans = 1 150
Doing the same for U and V components also showed the same results.
对U和V分量执行相同操作也显示相同的结果。
And also..
并且..
>>Y(150)
displayed:
显示:
ans = [144x176 double]
What I want is make an array for Y, U and V that has the dimensions [numberOfFrames height width] or [150 144 176].
我想要的是为Y,U和V制作一个数组,其尺寸为[numberOfFrames高度宽度]或[150 144 176]。 How can I do this?
我怎样才能做到这一点?
[1]: http://www.mathworks.com/matlabcentral/fileexchange/6318
[1]: http : //www.mathworks.com/matlabcentral/fileexchange/6318
I got the solution by using 我通过使用解决方案
>>Y = cat(3, Y{:} );
and I have a 我有一个
>>size(Y1)
ans =
144 176 150 144176150
Now, what I want is to convert it back to its original dimensions. 现在,我想要将其转换回其原始尺寸。 How can I do it?
我该怎么做?
使用mat2cell
>> Y = mat2cell( Y1, size(Y1,1), size(Y1,2), ones(1,size(Y1,3)) );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.