2

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.

Sakshi
  • 29
  • 11
  • see [plotting HSV 2D histogram](https://stackoverflow.com/a/29286584/2521214) and [plotting RGB 2D histogram](https://stackoverflow.com/a/43087883/2521214) for some inspiration – Spektre Aug 29 '17 at 08:10

1 Answers1

1

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

Sneaky Polar Bear
  • 1,611
  • 2
  • 17
  • 29
  • Hi..Thanks for the revert. I tried using histogram2(x,y) and it says "Undefined function or method '...' for input arguments of type 'double'." – Sakshi Aug 29 '17 at 06:10
  • I believe that you need a vector of double. There are several code example in the link I posted. It shows an example with double values (you don't need to be as complicated as that example as they spell out all parameters, but I am sure it works) – Sneaky Polar Bear Aug 29 '17 at 09:57