807 views
in GUI Development by
Hello all,

I want to display 8 bit Image data. Data is 8 bit fingerprint raw data. I used extern bitmap but it is RGB8888 format and I am getting tilted Image so I am confused how to display 8 bit raw data to screen.

Update me as soon as possible.

1 Answer

0 votes
by
Hello,

it would be helpful if you can provide more information about the exact format of "fingerprint raw data" and more information about your current implementation - e.g. a code snippet of your EwLoadExternBitmap() implementation.

Otherwise it is difficult to provide helpful advices.

Best regards,

Manfred.
by

Hi,

 

'Fingerprint raw data' means 8 bit gray data that consist information. So how to display that using extern bitmap? I have also attached externbitmaploader.c file. please have  a look.

from this file I set offset=1 manually and get image but it display black cross line, black line at bottom and also it display image verticle flipped(image 1). if i dosent set offset manually and let it be calculated it self then it display like in image 2.

Can you please give some deep document on offset.

 

Thanks,

Chand Bhadaniya

 

 

#include "ewrte.h"
#include "ewgfx.h"
#include "imagedata.h"   // contain imgdt[28056]
#include <stdint.h>

uint8_t imgdt[28056];    // Raw data for image


XBitmap* EwLoadExternBitmap( XString aName )
{
  XPoint         size;
  XBitmap*       bitmap;
  XBitmapLock*   lock;
  unsigned char* ptr;
  int            offset;
  int            x, y;
 	
  /* ==> TODO: Access your image and query all necessary data. At least
     we need the width and the height of the image in order to allocate
     the bitmap */
     
  /* In our simple example, we just use a fixed size */
  size.X = 167;
  size.Y = 167;     	
  	
  /* Now, create a new empty bitmap with the previously determined size and format */
  
  bitmap = EwCreateBitmap( EW_PIXEL_FORMAT_ALPHA8, size, 0, 1 );

  /* If the creation has failed */
  if ( !bitmap )
    return 0;

  /* Lock the entire bitmap for the write only operation */
  lock = EwLockBitmap( bitmap, 0, EwNewRect( 0, 0, size.X, size.Y ), 0, 1 );

  /* Get the pointer to the bitmap pixel memory */
  ptr = (unsigned char*)lock->Pixel1;
  offset = lock->Pitch1Y - size.X;
  printf("offset = %d\n", offset);
  offset = 1;           // image1 as contain offset =1, when comment this line we got image 2
 
  /* ==> TODO: Decode your image and copy row by row and pixel by pixel 
     from your decoded image into the bitmap. */

  int pix =0;

  /* Fill the bitmap row by row */

  for ( y = 0; y < size.Y; y++, ptr += offset )
    for ( x = 0; x < size.X; x++, ptr++ )
    {
      *ptr = imgdt[pix];
      pix++;
    }
  
  /* finally, unlock the bitmap */
  EwUnlockBitmap( lock );

  /* Return the filled bitmap */
  return bitmap;
}

 

 

 


 

 

 

 

by

Hello,

is it really the case, that the fingerprint reader provides the image with a size of 167x167 pixel? This does not match with the array size of 28056 pixel.

Concerning the vertical flipping, you have to copy the content from the fingerprint reader from bottom to top - see the following code snipped (not tested):

  unsigned char* dst; /* pointer to destination (bitmap) */
  unsigned char* src; /* pointer to source (fingerprint reader) */

  ...
   
  /* lock the entire bitmap for the write only operation */
  lock = EwLockBitmap( bitmap, 0, EwNewRect( 0, 0, size.X, size.Y ), 0, 1 );

  src = &imgdt[ 0 ];

  /* fill the bitmap row by row from bottom to top */
  for ( y = size.Y - 1; y >= 0; y-- )
  {
    /* calculate start pointer within current row */
    dst = (unsigned char*)lock->Pixel1 + y * lock->Pitch1Y;  

    /* copy the content of one row */
    for ( x = 0; x < size.X; x++ )
      *dst++ = *src++;
  }

Does this help?

Best regards,

Manfred.

by

Hi Manfred,

As per you said changes are applied. So image got flipped but the question remains same. it shows cross line and it also shows cross image. please find atteched image.

Thanks,

Chand Bhadaniya

by
Hello,

yes, the question remains the same: Is it really the case, that the fingerprint reader provides the image with a size of 167x167 pixel? This does not match with the array size of 28056 pixel.

There is some mismatch in the alignment - but I cannot give you more hints based on the provided information. Sorry.

Best regards,

Manfred.
by
Hi,
Yes the fingerprint reader provide the data in pixel (167*167 = 27889). I just take buffer of size 28056. i also check that doing buffer size of 27889 but reult remains same.
please tell me if you require more information i will provide.
Thanks,
Chand Bhadaniya
by

Hi Manfred,

Good news, 

Finally image is diaplayed well.(PFA)

Thanks for all your help.

by
Great! Now it looks good...
by
Hi,

May I ask a question?

When the function EWLoadExternBitmap return bitmap;
then, the bitmap will show on the screen ? or I need to do some operations ?

Thanks!

 

Best Regards,

Andy Dong
by

Hi Andy,

the extern bitmap can be used like any 'regular' bitmap resource within all views that are able to display bitmaps.

When the function EwLoadExternBitmap() returns, all views are updated automatically!

Best regards,

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...