Results 1 to 2 of 2

Thread: Bitplane separation an 8bit depth gray scale image, how?

  1. #1
    Join Date
    Apr 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Bitplane separation an 8bit depth gray scale image, how?

    Hello,
    I would like to load an 8-bit grayscale image and extract its eight bitplanes. Is it possible with QImage? Should I use the QBitArray and than QBitmap or my approach is wrong?

  2. #2
    Join Date
    Apr 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Bitplane separation an 8bit depth gray scale image, how?

    So, I loaded the grayscale image pixels as QImage to an array
    Qt Code:
    1. QVector<QRgb> szinindextabla = image.colorTable();
    2. QVector<QVector<quint8> > a(image.width(), QVector<quint8>(image.height()));
    3. for(int i=0;i<image.height();i++){
    4. for(int j=0;j<image.width();j++){
    5.  
    6. a[j][i]=qGray(szinindextabla[image.pixelIndex(j,i)]);
    7.  
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    Now, how to extract the bits?


    Added after 14 minutes:


    hm, i don't think this is the right approach, but it almost works, i created a QBitarray and do & 2^{bitplane no} then created QBitmap then draw points with QPainter on the QBitMap when bit is true. The LSB bitplane looks quite random and this is normal, but the 8th is complete white and it is not good.
    Last edited by szakos; 23rd April 2011 at 00:36.

Similar Threads

  1. Scale Image centered
    By metRo_ in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2010, 20:25
  2. how to scale a picture/image?
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 26th May 2010, 12:51
  3. QTabBar scrollbar separation
    By khcbabu in forum Qt Programming
    Replies: 1
    Last Post: 19th February 2010, 10:09
  4. Replies: 3
    Last Post: 6th March 2009, 15:11
  5. Image 32 bit depth to 8 bit depth
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 2nd September 2008, 09:35

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.