This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, September 4, 2006 8:51:03 AM(UTC)
Groups: Registered
Posts: 12
Hi,
I'm developing using lead tools 13.
I need to reduce bit depth from 16/12 bpp to 8 bpp.
Wanted to know what API can I use to reduce image's bit depth, and what algorithms are invoked when I use this API.
Thanks, Hagay.
#2
Posted
:
Monday, September 4, 2006 11:13:09 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hagay,
If you have 16/12 BPP Grayscale images and you want to convert the Bitmap to 8BPP Grayscale, you can use the L_GrayScaleBitmap as follows:
+------+
BITMAPHANDLE LeadBitmap; /* Bitmap handle to hold the loaded image. */ ...
/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap ("IMAGE1.CMP", &LeadBitmap, 0, ORDER_BGR, NULL, NULL);
/* Change the bitmap to grayscale */
L_GrayScaleBitmap(&LeadBitmap, 8 );
...
+------+
But if you want to convert to 8 BPP in general case, you can use the L_ColorResBitmap function, which converts a bitmap from any bits-per-pixel to any bits-per-pixel. You can use the function as follows:
+------+
...
L_ColorResBitmap(&LeadBitmap, &LeadBitmap, 8, CRF_OPTIMIZEDPALETTE, NULL, NULL, 0, NULL, NULL );
...
+------+
For more information about the L_GrayScaleBitmap and L_ColorResBitmap functions, please refer to the LEADTOOLS Main API Documentation v13 and read the following topics:
- L_GrayScaleBitmap
- L_ColorResBitmap.
Please let me know if this helps.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Tuesday, September 5, 2006 2:49:09 AM(UTC)
Groups: Registered
Posts: 12
Hi Maen,
Thanks for the fast reply.
I have a few follow up questions:
1. I assume the LBitmap class library equivalent to L_GrayScaleBitmap is LBitmapBase::GrayScale. Please confirm.
2. I need to know what bit depth reduction algorithm is used in the operation.
Thanks, Hagay.
#4
Posted
:
Tuesday, September 5, 2006 3:24:08 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
1. Yes, this is correct. This ClassLib function calls the DLL API function internally.
2. Our image processing function algorithms are mostly not published in our documentation. If any function is not performing what you expect it to do, of if you are facing any problem with it, you can send us the details of the problem and we will check it and possibly forward it to our image processing software engineering team.
Having said that, in the case of converting from 12/16 bit grayscale to 8 bit grayscale, I think the operation used is simply keeping the most significant 8 bits and dropping the rest.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#5
Posted
:
Wednesday, September 6, 2006 10:48:11 PM(UTC)
Groups: Registered
Posts: 12
Hi Amin,
Thanks for the reply.
I still need to know exactly, since it might affect the way we do our image processing, and it will effect our decision as to use the LEAD bit depth reduction or not.
Could you please check and have an answer regarding the algorithm used?
Thanks, Hagay.
#6
Posted
:
Monday, September 11, 2006 12:39:54 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Hagay,
This is not explicitly documented and I don't have direct access to the source code, but I did my own test by converting 16-bit grayscale data to 8-bit and doing a binary comparison, and the result was similar to what I expected: the resulting 8 bits were the high-order byte of the source 16 bits. This means a pixel whose value is 0x01FF will become 0x01, not 0x02 (truncated, not rounded up).
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#7
Posted
:
Monday, September 11, 2006 12:43:43 AM(UTC)
Groups: Registered
Posts: 12
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.