i want to show image RGB colour histogram in cocoa application. Please suggest possible way to do it with objective c or any third party library available to achieve this.
相关问题
- How to get the background from multiple images by
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- How do I append metadata to an image in Matlab?
- Custom Marker performance iOS, crash with result “
well this is a problem as RGB colors are 3D space so their histogram would lead to 4D plot which is something we do not really comprehend.
So the solution to this is to convert the 4D plot to 3D plot somehow. This can be done by sorting the colors by something that has some meaning. I will not speculate and describe what I am using. I use HSV color space and ignore the V value. This way I lose a lot of color shade info but it is still enough to describe colors for my purposes. This is how it looks like:
You can also use more plots with different
V
to cover more colors. For more info see:Anyway you can use any gradient sorting or any shape of your plot that is completely on you.
If you want pure RGB then you could adapt this and use RGB cube surface or map it on sphere and ignore the length from
(0,0,0)
(use unit vectors) something like this:So if you
R,G,B
are in<0,1>
you convert that to<-1,+1>
then compute the spherical coordinates (ignoring radius) and you got your 2 variables instead of 3 which you can use as a plot (either as 2D globe base or 3D sphere ...).Here C++ code how to do this (made from the HSV histogram):
pic0
, output image ispic1
(histogram graph)pic2
is copy ofpic0
(remnant of old code)zed
is the Zed buffer for 3D display avoiding Z sorting ...I use my own picture class for images so some members are:
xs,ys
size of image in pixelsp[y][x].dd
is pixel at (x,y) position as 32 bit integer typeclear(color)
- clears entire imageresize(xs,ys)
- resizes image to new resolutionAs the sphere is a 3D object you should add rotation to it so all the surface is visible in time (or rotate with mouse or whatever) ...