Size of an image as a single value

5 views (last 30 days)
I have the ff info from an image using the size function; 3456x 4608x 3 uint8, however i need the size of the image as a single value to compute for spatial frequency in cycles/degree of visual angle. any idea how i can go about this. thank you
  4 Comments
Dyuman Joshi
Dyuman Joshi on 16 Jan 2024
Edited: Dyuman Joshi on 16 Jan 2024
There are no units to the output of size. The function size() returns the dimensions of an array, which are just plain numbers.
However, for an array representing an image, each element is considered a pixel. Given that the image you have is a 3D array, it means that you are working with a RGB image, and it can be considered 3456 pixels tall, 4608 pixels wide with the 3 pages corresponding to the Red, Green and Blue intensities/values.
If by physical size you mean the number of bytes it takes in storage, you can calculate it manually as @FPDodds has shown below or you can call whos on the array like this -
y = rand(5,6,7);
whos y
Name Size Bytes Class Attributes y 5x6x7 1680 double
Stephen23
Stephen23 on 24 Jan 2024
"And Please, which unit are the dimensions (3456x 4608x 3), produced from the size function: size (image);"
Probably: number of vertical pixels x number of horizontal pixels x number of color channels

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 16 Jan 2024
"I actually meant the physical size when displyed though." That depends on the figure size. You can resize the figure to any size up to the size of your monitor. You can put a ruler up to your screen and measure it. Why do you need to know this?
  9 Comments
Naa Adjeley
Naa Adjeley on 27 Jan 2024
okay, well noted. I just did that but for some answers, I am unable to see the vote icon.
Image Analyst
Image Analyst on 27 Jan 2024
Only official "Answers" will have accept and vote icons. Comments below those answers will not. Thanks for accepting! 🙂

Sign in to comment.

More Answers (1)

FPDodds
FPDodds on 16 Jan 2024
Hi, the units in the dimensions you provide are pixels. I.e. your image is 3456 pixels tall and 4608 pixels wide. The 3 are the layers of the image, presumably RGB. Depending on bit depth of the image, there overall size will be different. You say uint8 so there are 8 bits per pixel for each colour. This gives you an overall image size of 382,205,952 bits = 47MB.
If you mean physical size when displayed, then you want to look at your screen resolution and work out how many pixels per inch you're getting.
  1 Comment
Naa Adjeley
Naa Adjeley on 16 Jan 2024
oh okay, thank you. I actually meant the physical size when displyed though.

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!