Results 1 to 12 of 12

Thread: Raw Images on Qt Widget

  1. #1
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Raw Images on Qt Widget

    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

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    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

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    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

  4. #4
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    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.. 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

  5. #5
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Raw Images on Qt Widget

    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

  6. #6
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    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

  7. #7
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Raw Images on Qt Widget

    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::NoOpaqueDe tection));

    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

  8. #8
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    Indexed Color.. means you have to specify your own color table.

    Qt Code:
    1. QVector<QRgb> colorTable(256);
    2. for(int i=0;i<256;++i)
    3. colorTable[i] = qRgb(i,i,i);
    4. image.setColorTable(colorTable);
    To copy to clipboard, switch view to plain text mode 

    Joh
    Last edited by JohannesMunk; 19th March 2010 at 13:49.

  9. #9
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    If you want to draw a cross or a tick on top of the image, you will need to convert the image from indexedColor:

    Qt Code:
    1. // Load GrayScale as 8-bit-IndexedColor
    2. QImage image(buff,280,352,280,QImage::Format_Indexed8);
    3. // Setup Color-Table
    4. QVector<QRgb> colorTable(256);
    5. for(int i=0;i<256;++i)
    6. colorTable[i] = qRgb(i,i,i);
    7. image.setColorTable(colorTable);
    8. // Convert to RGB32 for painter
    9. QImage image2 = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
    10. QPainter painter(image2);
    11. painter.drawLine(...)
    12. ..
    13. ui->label->setPixmap(QPixmap::fromImage(image2));
    To copy to clipboard, switch view to plain text mode 

    Does that do the trick?

    Joh
    Last edited by JohannesMunk; 19th March 2010 at 13:51.

  10. #10
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Raw Images on Qt Widget

    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

  11. #11
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    Ah sorry. The Constructor needs a pointer to a QPaintDevice. QImage is a QPaintDevice.. We just need to pass the pointer:

    Qt Code:
    1. QPainter painter(&image2)
    To copy to clipboard, switch view to plain text mode 

    Joh

  12. #12
    Join Date
    May 2010
    Posts
    53
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Raw Images on Qt Widget

    Quote Originally Posted by Ratheendrans View Post
    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.

Similar Threads

  1. Images
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2009, 15:22
  2. Replies: 4
    Last Post: 27th July 2009, 15:45
  3. How can I change widget images and layouts?
    By sendyou in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2008, 11:07
  4. Display multiple Images in a widget
    By jeetu_happy in forum Qt Programming
    Replies: 2
    Last Post: 7th March 2007, 11:24
  5. Widget to display images and text ?
    By probine in forum Qt Tools
    Replies: 4
    Last Post: 9th October 2006, 20:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.