Reputation: 3
Hi can someone help me regarding this code, i know that it reads the image and shows the red channel on the histogram for the RGB image (Fruits1).
colourImage = imread('Fruits1.jpg'); //read image
redHistogram = double(colourImage(:,:,1)); //what does this line do?
figure, hist(redHistogram(:),124); //what does this line do?
Upvotes: 0
Views: 53
Reputation: 420
redHistogram = double(colourImage(:,:,1)); //what does this line do?
This takes the red plane of the image and converts each pixel intensity from an integer (0-255) to a floating-point value (double). The result is a 2-d array of these values.
figure, hist(redHistogram(:),124); //what does this line do?
This displays a histogram of the pixel intensities from above, sorted into 124 equal-sized bins.
Upvotes: 1