To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I have been able to read my sample video one frame at a time on Matlab.
I would now like to re-size each frame (by averaging adjacent rows/columns)
Can someone explain how to do this? And how can I find out the number of rows or columns of the frames?
No products are associated with this question.
[number_of_rows, number_of_columns, number_of_channels] = size(YourFrame);
and provided rows and columns are even,
t1 = double(YourFrame(1:2:end,:,:)) + double(YourFrame(2:2:end,:,:)); t2 = t1(:,1:2:end,:) + t1(:,2:2:end,:); MeanFrame = cast(t2 ./ 4, class(Yourframe));
Is it possible to explain this written commands as I have literally only started looking at Matlab yesterday.
Thanks for your quick reply
There is a function IMRESIZE in the Image Processing Toolbox that is designed to do exactly this, and it will take into account the datatypes for you.
A = uint8(magic(6))
imresize(A,0.5,'box') imresize(A,[2 2],'box') imresize(A,[1 6],'box')
Here the 'box' argument tells it to just resize using block averages as you mentioned. There are other ways to resize as well. Just look at the help for IMRESIZE if you have it avaliable to you.