Size of an image as a single value
5 views (last 30 days)
Show older comments
Naa Adjeley
on 16 Jan 2024
Commented: Image Analyst
on 27 Jan 2024
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
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
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
Accepted Answer
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
Image Analyst
on 27 Jan 2024
Only official "Answers" will have accept and vote icons. Comments below those answers will not. Thanks for accepting! 🙂
More Answers (1)
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.
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!