[quote=“valeri”]Hi,
Actually it is the answer on the original question: is there an easy way to read for example BMP image into the array.
The below function do the job. This function is in principle a part of class, we use for storage and processing images. It could be posted if have general interst. Of cause root is not the best tool for image processing, but sometimes it could be convenient for the small samples.
VT
[/quote]
I’ve just spent some time writing a library of functions to deal with PNG files. But using libpng [libpng.org/pub/png/] to deal with the real dirty stuff at the lowest level.
I’m just about to start collating it into a proper C++ class so maybe that will be useful if I ever convince myself that I’ve got the memory deallocation sorted…
Hi chris,
current development version of ROOT provides
(via ASImage, which has built-in libpng) support
for png image reading/writing for all ROOT platforms/compilers.
Do not spend your time for re-inventing the wheel
ASImage is “super” library, e.g. much more sophisticated
than Qt’s QImage, better than ImageMagick etc.
ROOT team works closely with ASImage author (Sasha Vasko),
e.g. currently I’m adding vector graphics to it.
There are many tasks in ASImage development were
we (ROOT team and Sasha Vasko) need supporters/volunteers.
It is a new desing curve
The derivation the TImage class from TPostscript does indicate the class in question is becoming the print driver rather the image processing class.
This I can not understand. TImage should remain TImage. If one needs the printer driver based on TImage that should be done separately. As Rene teach us do not put different fruits in one basket.
Hi Valeri,
TImage remains image processing class
with vector graphics capability (I’m “stealing” a lot of from Xserver code).
In fact, now, it more or less corresponds to Qt4.0 QPainter doc.trolltech.com/4.0/qt4-arthur.html
Hi Valeri,
I do not see any contradictions.
We has an image processing class which
allows to read images into memory (btw, RLE compressed array),
dispaly this memory in the canvas, write this memory into images.
To satisfy user requests we added
vector graphics to it i.e. draw lines, polygons etc.
over memory compressed array. Thats addon correponds
to addition QPainter methods to QImage class.
As a result one can manipulate,save ROOT canvas graphics into
GIF,PNG etc formats in batch mode (“gifbatching”).
BTW, this is very important for Carrot development carrot.cern.ch/
There are many other interesting directions opened up …
Just few of them:
improving canvas graphics performance.
It’s possible to rewrite canvas graphics as painting over TImage
and flushing TImage onto screen.
That will allow to improve canvas graphics quality by adding anti-aliasing
for lines drawing
browser (IE, mozilla …) ROOT plugin development, which will
interact with Carrot website (server side macros)
Hi Valeri,
thanks for you points and discussion.
It’s really not good to derive TImage from TVirtualPS
because TVirtualPS is “too canvas oriented”, e.g. everything
in pad coordinates … even despite of the fact that TImage is
a part of graf library (which seems to be also not correct).
The better solution is keep TImage derived from Tnamed as it’s
right now and create a new class derived from TVirtualPS(say “TImagePS”).
I will correct my code, which is not yet in CVS.
[quote=“Valeriy Onuchin”]Hi chris,
current development version of ROOT provides
(via ASImage, which has built-in libpng) support
for png image reading/writing for all ROOT platforms/compilers.
Do not spend your time for re-inventing the wheel
ASImage is “super” library, e.g. much more sophisticated
than Qt’s QImage, better than ImageMagick etc.
ROOT team works closely with ASImage author (Sasha Vasko),
e.g. currently I’m adding vector graphics to it.
There are many tasks in ASImage development were
we (ROOT team and Sasha Vasko) need supporters/volunteers.
Regards. Valeriy[/quote]
Dear Valeriy O.
Please don’t mix the different topics and points to avoid the mess (as Rene Brun teaches us).
Nobody dicuss the qulity of ASImage library
QImage does what QImage C++ class should. QImage is NOT a C++ LIBRARY. QImage is a part of Qt library. So comparing one single class of the big library vs another entire library one risks arriving to a wrong conlusion and mislead the ROOT users.
QImage porivides a tramsparent and convinient interface to the various pixel file format.
Likely ROOT does need that. I think ROOT needs some image processing classes also. However it is a SEPARATE issue.
QImage is not an image processing class.
The original issue was , “how to access ther pixel” file and the proper soltuion is QImnage. It does fit the task. The image processing is expected to be provided by the user code in this oarticular case.
Since I am not aware about the concrete image processing needs I personally hesistate to provide any advice which library is “super” one.
[quote=“jwodin”]Is there an easy way to read in an image (JPEG, GIF, BMP, whatever…) and get the actual pixel information out in an array or histogram? For example, if I have a 400x300 grayscale BMP, can I read it in and output the pixel grayscale data into an array or TH2F (I’d like to do this so I can do some processing and fitting on the image data).
jesse wodin[/quote]
I have the same problem. And I have wasted almost a whole day trying to convert a greyscale 8bit .bmp into a TH2D histogram. Please point me to the function layed out by Valeriy: TH2D GetHist(…)
As far as I understand this thread has not solved the initial problem adequately.
There must be a simple way to fill a histogram from an picture / image?