How to draw histogram?
Anyone, please help me to draw histogram
Qt Creator is an IDE, just like visual studio or eclipse or netbeans. It is not relevant for your problem.
But, if you have a QImage, how hard is it to loop over it's pixels to create a histogram? What is your problem with that?
I don't know how to use Qwt in Qt. I get few errors.
It has a width, it has a height - you should be able to construct two nested loops over it. It has a pixel method that takes x and y. What else do you need?
Did you have a look to the documentation by any means?
At the top of this page anybody can enter the documentation.
There is an access method for "pixels":http://developer.qt.nokia.com/doc/qt-4.8/qimage.html#pixel
These methods are returning QRbg. Details you may find under "QColor":http://developer.qt.nokia.com/doc/qt-4.8/qcolor.html
Please give me some examples
Qt does not have directly the possibility to draw histograms. There is "QWT":http://qwt.sourceforge.net/ using Qt for drawing graphs. This library supports also drawing a histogram. Unfortunately, I am not aware of a ready to use example.
[quote author="mario5046" date="1324731901"]OK, but I don't know how to draw histogram. Can you give me any example?[/quote]
You would have to ask the lazyweb for that or buy a nice text book on image processing. As koahnig already stated, Qt does not have any builtin means for that.
But if you don't know how an image histogram is made, what are you going to do with it?
May be this can be helpful:
Here's an example how to draw a histogram (bar chart), provided you already have the data
More charts examples: http://doc.qt.io/qt-5/qtcharts-examples.html