Forming a giant array of multiple 64 x 64 matrices
Show older comments
[file path] = uigetfile('*.avi','Pick a Video');% this line opens a pop up window so that you can choose your video for further processing
video = VideoReader([path file]);% the video chosen through UI get stored in video object
numOfFrames = video.NumberOfFrames;% this will be a number (total number of frames in your chosen video)
%allFrames = read(video);% catching all the frames from the video in object allFrames
for i=1:1:numOfFrames
try
lFrame = read(video, i);%frames(:, :, :, i);
catch
break;
end
lRFrame = lFrame(:,:,1);
lGFrame = lFrame(:,:,2);
lBFrame = lFrame(:,:,3);
lGray = 0.299*lRFrame + 0.587*lGFrame + 0.114*lBFrame;
grayImage = imresize(lGray, [256 256]);
% step 2 of the algorithm begins from here %
meanFilterFunction = @(theBlockStructure) mean2(theBlockStructure.data(:)) * ones(1,1, class(theBlockStructure.data));
blockSize = [4 4];
blockyImage4 = blockproc(single(grayImage), blockSize, meanFilterFunction);
I am getting a 64 x 64 image in 'blockyImage4' but since it is in a loop , the value flushes itself in very next iteration everytime.
I want an array of images which can store (possibly all) images(matrices). and i should have access to them all. if all the images could not be stored in an array then how to store only two images of consecutive iterations since i need 'i' and "i+1" th image to find out the diffrence between them. Please help
Answers (0)
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!