12345678910111213141516171819202122232425262728 |
- %% Vector to 3D Matrix containing N images
- % The function provides convertion from a Vector containing N grayscale
- % [0, 255] layers pictures of square size ImgSz*ImgSz [px] in a 3D Matrix
- % containing N layers, each one of them will contain a single picture.
- %
- % Inputs:
- % - imgSz Size of the single squared picture
- % - N Total Number of pictures
- % - Xset Input Vector
- %
- % Outputs:
- % - Xmat 3D Matrix containing the pictures
- %%
- %% Filling the Matrix
- % The for cycles loop over the Vector Xset: the outer cycle runs over the N pictures,
- % the inner cycle copies a row of each picture to the current one.
- %%
- function Xmat = Vector2Matrix(imgSz, N, Xset)
- imgSzSq=imgSz^2;
- Xmat = zeros(imgSz*imgSz, N,'uint8');
- for jj=1:N
- Xmat(:,jj)=Xset(imgSzSq*(jj-1)+1:imgSzSq*jj);
- end
- end
|