[Qt-interest] display grayscale image?

Michael Jackson mike.jackson at bluequartz.net
Wed Apr 28 18:03:08 CEST 2010


On 4/28/10 11:49 AM, in article
g2jecaaccc81004280849yabaa4dedrf364ee2fc0b3ab62 at mail.gmail.com, "caius
ligarius" wrote:

> Yes I looked at that but what would the format of the data be if I have
> 12Bit Grayscale image?
> 
> Caius
> 
> On Tue, Apr 27, 2010 at 3:55 PM, <kurt.korbatits at nokia.com> wrote:
> 
>>  You should be able to wrap a QImage around the data.
>> 
>> QImage::QImage ( uchar * data, int width, int height, Format format )
>> 
>> 
>> Kurt Korbatits
>> Software Engineer
>> Nokia - Qt Development Frameworks
>> 
>> 
>>  ------------------------------
>> *From:* qt-interest-bounces at trolltech.com [mailto:
>> qt-interest-bounces at trolltech.com] *On Behalf Of *ext caius ligarius
>> *Sent:* Wednesday, April 28, 2010 8:45 AM
>> *To:* qt-interest at trolltech.com
>> *Subject:* [Qt-interest] display grayscale image?
>> 
>> Hi,
>> 
>> I am a first time user and am struggling to display a simple int* (512x512)
>> grayscale image pointer.
>> 
>> I have looked at some examples but it is still not clear. Seems like one of
>> the ways would be to create QGraphicsScene do an addPIxmap  and pass it to a
>> QGraphicsView. My question is how do I add my 12Bit int* image buffer array
>> which I already have in memory to addPixmap or is there some other way to do
>> it?
>> 
>> 
>> Thanks,
>> Caius
>> 
You may want to run some sort of transform on your data so that you end up
with an 8 bit image with a lookup table. You can generate the lookup table
your self. I do with with "normal" 8 bit grayscale images. Not sure of all
the ramifications with a 12 bit grayscale image buffer though.

 And I do use a QGraphicsScene with a QPixMap added to the scene.

Mike Jackson




More information about the Qt-interest-old mailing list