0

I got a piece of MATLAB code like this:

 input0(i,k,:,:)=imread(filename);

Anybody knows what it is used for? Thanks.

zengsn
  • 5,045
  • 1
  • 14
  • 9
  • Just a small side note: I often see the syntax `input0(:, :, channel, frameNumber)` for videos. That way, `input0(:,:,:,x)` has exactly the same form as a color image, and you can easily use the image tools, such as `imshow` or others without having to manipulate the frame first. – hbaderts Jan 09 '16 at 07:52
  • Oh, and: `i` and `j` are used to denote the imaginary unit, so using them as variable names is not recommended (though of course it is possible). There are some details in [this question](http://stackoverflow.com/questions/14790740/using-i-and-j-as-variables-in-matlab) – hbaderts Jan 09 '16 at 07:59
  • Thank you to comment. Another question comes. This code was fine when I tried to read a 40X40 pixel image. While it thrown an error of "Subscripted assignment dimention mismatch" when I changed to read a 241X241 pixel JPG image. It looks that the size of matrix is not large enough to hold that image. But I supposed that input0(i,k,:,:) does not limit the size of matrix? – zengsn Jan 17 '16 at 12:02

1 Answers1

2

it reads an image to the third and fourth dimension of input0 matrix input0 is a table where each element is an image with dimension size(input0,3)*size(input0,4) and (i,k:,:) notation is used to select all rows and columns in position (j,k)

m7mdbadawy
  • 920
  • 2
  • 13
  • 17