Plotting histogram of image data present in a stack

J
Jaxon · Nov 3, 2020 · 1.9K views
Question
how to plot histogram of a single image data. But it's not clear to me how the data in a stack can be plotted. For exmaple,    f = "Test_Image.tiff"; img_data = imfinfo(f); imhist(img_data) double, uint8, int8, logical, uint16, int16, single, uint32, int32 Instead its type was struct. Any suggestions?
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 12, 2026

iminfo just read the metadata of the image. Use imread() to read the image as matrix

 

f = "Test_Image.tiff";
img_data = imread(f);
imhist(img_data)

If it is an rgb image, then first convert it to grayscale too

 

f = "Test_Image.tiff";
img_data = rgb2gray(imread(f));
imhist(img_data)
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!