0
$\begingroup$

Hi I am trying to get the image size of the uploaded image in MATLAB. So far I have got :

read=imread(image.png)

ymax=size(read) (1);
xmax=size(read) (2);

However this gives me an error. The image size is 300px by 256px, and I want my ymax and xmax to automatically get the pixel values. How do I do this?

$\endgroup$
2
$\begingroup$

It's not a MATLAB'ish way of doing that, try:

[xmax, ymax, nchan] = size(read);

Where nchan is the number of channels. Also it can be done by:

xmax = size(read, 1);
ymax = size(read, 2);

Or even:

[xmax, ymax, ~] = size(read);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.