[vtkusers] Brightness

bharathram.rambadran at wipro.com bharathram.rambadran at wipro.com
Thu Jan 8 23:13:39 EST 2004


Hi,

I am working on changing brightness levels of an Image. I am using
Qt/e(embedded) libraries to help me in the process. So far I have
managed to load a image file in a Qpixmap and display it using a
Qcanvasview.

The depth of the Qpixmap is 16.
After,
QImage img = myPixmap.convertToImage().
The QImage's numcolors is only 2.

I have tried the following to adjust brightness. Since I am kind of new
to Qt. I am not sure if this is right. This does not work  and the image
seems to remain the same when I test it with various values.

oid TIQ_ImageDocument::adjustBrightness(int magnitude) {

    QImage img;
    img.setNumColors(65535);
    img = m_pmScaled.convertToImage();
    img.setNumColors(65535);

    img.detach();

    img.setNumColors(65535);

     for (i=0; i<img.numColors(); i++) {
            QRgb rgb = img.color(i);
            QColor c(rgb);
            rgb = c.dark(magnitude).rgb(); // magnitude was given as
300, 600 etc..
            img.setColor(i,rgb);
     }

     m_pmScaled.convertFromImage(img);

}

1)Is there anything I am assuming which I should not.
2)IS 65535 a good number?
3) is there a better way to change brightness of an image.

Regards
Bharath Ram
"Easy way to start flying: Throw yourself at the ground and Miss! "


Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.



More information about the vtkusers mailing list