PDA

View Full Version : Raw Images on Qt Widget



Ratheendrans
18th March 2010, 13:14
Hi All,

I am working on application which requires Fingerprint sensor's raw images to be displayed on QT widget.

Since I am relatively new to QT,Can any one enlighten me on how this can be achieved using QT libraries.


Thanks in Advance.
Ratheendran

JohannesMunk
18th March 2010, 15:52
By RAW images you are refering to uncompressed image data, that you have in memory?

Try constructing a QImage with this constructor:

QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format );

Than you can show it with a QLabel.

HIH

Johannes

aamer4yu
18th March 2010, 18:15
or may be RAW means the RAW format used in digital cams...
not sure how RAW data is converted to jpg.
Anyways no harm in trying above post :)

JohannesMunk
18th March 2010, 18:28
That thought crossed my mind too, but I really doubt, that a fingerprint sensor even supports multiple colors. Because the one thing that really would be difficult in handling camera RAW files is to make something usefull of the Bayers pattern (http://en.wikipedia.org/wiki/Bayer_filter).. A Bayers pattern sensor has a lot of difficulties, with high frequency geometric contrasts.. Trading geometric resolution for color resolution... But the highest possible geometric resolution is what you need in a fingerprint sensor. So: no Camera RAW involved here!

Joh

Ratheendrans
19th March 2010, 13:11
Thanks Johannes,

I am able to display the RAW image on QLabel by following your steps,in this case the background goes black and the fingerprint impression is colored.
if the same data is stored in a file and displayed after converting into standard format,I get the background color as white and fingerprint impression in black,my question is how I can change the memory image to look like the latter case.

I want to superimpose the correct/wrong signs on this image,how can I achive it?

Thanks,
Ratheendran

JohannesMunk
19th March 2010, 13:26
You need to make sure that you specify the correct (color) format in the QImage constructor. If you get wrong colors something went wrong. How is your data represented? As 8-bit Grayscale? So that now you have the grayscale as red-channel?

What do you mean by correct/wrong signs? Overlay another matching/nonmatching fingerprint?

Johannes

Ratheendrans
19th March 2010, 14:24
Hi Johonnes,

The image is 'Format 8-BPP monochrome' is the documented in the user manual.

I used the below funtions
snapshot of the code
QImage image(buff,280,352,280,QImage::Format_Indexed8);
ui->label->setPixmap(QPixmap::fromImage(image,Qt::NoOpaqueDet ection));

there is also a 'Note' on http://doc.trolltech.com/4.6/qimage.html#Format-enum which is copied below.
"Note: Drawing into a QImage with QImage::Format_Indexed8 is not supported"

so,what is the work around?



And Correct/Wrong signs are the tick/cross marks on the fingerprint image which I need to display on the image, once the verification is completed.

Ratheendran

JohannesMunk
19th March 2010, 14:31
Indexed Color.. means you have to specify your own color table.



QVector<QRgb> colorTable(256);
for(int i=0;i<256;++i)
colorTable[i] = qRgb(i,i,i);
image.setColorTable(colorTable);


Joh

JohannesMunk
19th March 2010, 14:45
If you want to draw a cross or a tick on top of the image, you will need to convert the image from indexedColor:



// Load GrayScale as 8-bit-IndexedColor
QImage image(buff,280,352,280,QImage::Format_Indexed8);
// Setup Color-Table
QVector<QRgb> colorTable(256);
for(int i=0;i<256;++i)
colorTable[i] = qRgb(i,i,i);
image.setColorTable(colorTable);
// Convert to RGB32 for painter
QImage image2 = image.convertToFormat(QImage::Format_ARGB32_Premul tiplied);
QPainter painter(image2);
painter.drawLine(...)
..
ui->label->setPixmap(QPixmap::fromImage(image2));


Does that do the trick?

Joh

Ratheendrans
22nd March 2010, 14:06
Thanks Joh, for your support and response.

I tried your code,I didn't find any of QPainter constructor called with QImage so unable to draw line over the fingerprint image. can you suggest an alternative
(QPainter painter(image2))


Ratheendran

JohannesMunk
22nd March 2010, 14:43
Ah sorry. The Constructor needs a pointer to a QPaintDevice. QImage is a QPaintDevice.. We just need to pass the pointer:


QPainter painter(&image2)

Joh

agerlach
16th August 2010, 21:44
Hi All,

I am working on application which requires Fingerprint sensor's raw images to be displayed on QT widget.

Since I am relatively new to QT,Can any one enlighten me on how this can be achieved using QT libraries.


Do you mind me asking what fingerprint sensor you are using? I need to include fingerprint reading into an application and I was just wondering what scanner you used and if you were using any SDK for fingerprint matching. Thanks.