Clear Filters
Clear Filters

how to access first subimage from mat2cell when it is divided into 8x8 images?

1 view (last 30 days)
suppose we have image which is split into 8x8 subimages by using mat2cell. now i have to access first subimage from this 8x8 cells. how to do this.suggest some code
  2 Comments
ramya
ramya on 15 Mar 2018
Edited: ramya on 15 Mar 2018
a=VideoReader('test.mp4 ');
b = read(a,1 );
c=rgb2gray(b );
nframe=a.NumberOfFrames ;
for i=115
prev_frame =read(a,i-1 );
e=rgb2gray(prev_frame );
figure
imshow(e );
pause(0.2)
current_frame =read(a,i);
h=rgb2gray(current_frame );
figure
imshow(h);
rows = 8 ;
columns = 8 ;
[H,W,~] = size(c );
szH = [repmat(fix(H/rows),1,rows )];
szW = [repmat(fix(W/columns),1,columns )]; //to split into window size of 8x8 as per my algorithm
C = mat2cell(e, szH, szW )';
D = mat2cell(h, szH, szW )';
figure
for j=1:rows*columns
subplot(rows,columns,j), imshow( C{j } ) //to plot above cells
end
figure
for j=1:rows*columns
subplot(rows,columns,j), imshow( D{j } )
end
end
here is the code now i have to access C{1},C{2} and so on to perform std on each subimage

Sign in to comment.

Answers (0)

Categories

Find more on Scripts in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!