image processing

Login to reply to this topic.
Mon, 2007-09-03 13:11
Joined: 2007-06-30
Forum posts: 7

Hi,all

I use N73 to process image.Firstly I obtain CFbsBitmap object from CCamera and then save it as bmp format.But I find the saved file is 24-bit image and very large.I want to convert it into 8-bit bmp fomat.Can anybody do me a favor and tell me which interface or function in symbian can do this.Or give me some examples.

By the way,I want to know whether we must convert image into bmp fomat before image processing?

Thanks in advance.


Mon, 2007-09-03 13:42
Joined: 2006-09-18
Forum posts: 68
Re: image processing

Hi I don't know if this will save the file as 8 bpp, but you may call CFbsBitmap::SetDisplayMode(EColor256) and then make it a .bmp, I've never converted a bitmap to 8 bpp though and are therefore not sure if it is actually supported.

No you don't need to convert the image to bmp before image processing, in fact you'l have to write you're own image processing functions to do things like rotate or scale the bmp. When the SDK docs speak about a bitmap it usually refers to a CFbsBitmap. So if you would only like to do operations on a image just leave it as a CFbsBitmap.

If you would just like to save a smaller file then considder using png or jpeg.

Mon, 2007-09-03 14:24
Joined: 2007-06-30
Forum posts: 7
Re: image processing

Werries,Thanks for your reply.

But in my project,I need to do some digital image processing. Not only rotate or scale the bmp,but also segment and restore the bitmap. Exactly I know using png or jpeg is smaller,but it is hard to processing.

You said "call CFbsBitmap::SetDisplayMode(EColor256)", I will try to do it.

If somebody can give me some examples,I will appreciation your kindness.

Thanks.

Mon, 2007-09-03 16:03
Joined: 2006-09-18
Forum posts: 68
Re: image processing

Are you using a library or previously developed code to do this?, otherwise you can get a pointer to the "raw" data of the bitmap as follows:

TInt bitmapStride = aBitmap->DataStride();//amount of bytes per scanline
aBitmap->LockHeapLC(ETrue);//lock shared heap
TUint32 *bitmapPtr = aBitmap->DataAddress();

// Do some image processing here
CleanupStack::PopAndDestroy();//unlock the shared heap

Before calling DataAddress() the shared heap must be locked, and afterward it must be unlocked. I asume you will have at least 2 CfbsBitmaps for segmentation and restoration, you only need one heap lock and one unlock, but call it on the larger bitmap, or make sure you call it with ETrue as parameter.

I think it would be better for memory not to convert the image to a .bmp, segmentation shouldn't be to difficult to do inline.

  • Login to reply to this topic.