1

I computed histogram using vImageHistogramCalculation_ARGB8888(...). I now have histogram data for each of the three RGB channels stored in 256 bins. My questions is what's the way to plot these values in a UIView using OpenGLES or Core Graphics? It needs to be done in real time (at least 30 frames per second).

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
  • This code from 2016 _may_ help: flexmonkey.blogspot.co.uk/2016/05/a-histogram-display-component-in-swift.html – Flex Monkey Feb 05 '18 at 21:25
  • I saw that code, but the problem is it draws three layers of RGB histograms separately without mixing. What's the way to draw by mixing colors of overlapping layers? – Deepak Sharma Feb 06 '18 at 09:10

1 Answers1

1

You could do either. Neither approach is likely to be a problem at 30 frames a second.

Core Graphics is easier, so I'd start out by creating a custom subclass of UIView and overriding the draw(_:) method.

In that method you could use UIBezierPath or CGPath to draw a series of rectangles the represent the bars of your histogram.

Give it a shot and report back if you get stuck.

Duncan C
  • 128,072
  • 22
  • 173
  • 272