Sakshi
Sakshi

Reputation: 29

How to plot 2-D histogram of a normalized RGB image in Matlab

I have an original RGB JPEG image of which I have created a normalized RGB image. I'm able to plot the histrogram for this normalized RGB image. I need to now plot a 2-d histogram of the normalized RGB image, where the 2 axes represent the normalized red and green components of each pixel in Matlab. Please help me with this.

Upvotes: 2

Views: 373

Answers (1)

Sneaky Polar Bear
Sneaky Polar Bear

Reputation: 1671

I think you just need to use histogram2(x,y)

Create two vectors x and y such that x represents the R value of all pixels and G represents the G value of all pixels (make sure same order or make a 2 column vector). Then make the call above and show(), and it should give you what you are after.

https://www.mathworks.com/help/matlab/ref/histogram2.html?requestedDomain=www.mathworks.com

Upvotes: 1

Related Questions