Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, June 20, 2012 3:26:14 AM(UTC)

kb7  
kb7

Groups: Registered
Posts: 71


Hi,

Can you please send me a sample example which uses only window level and Median noise options to enhance the image after loading it? I am using Leadtools v17 and CDLLs.

Thanks..
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, June 20, 2012 5:38:18 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

These functions are implemented in our Main C DLL demo that ships with the SDK. You can find the source code of the demo in the following folder:
[LEADTOOLS 17]\Examples\CDLL\MainDemo

For a small sample code, please see the following help topics in the LEADTOOLS C DLL help file:
- L_WindowLevel
- L_MedianFilterBitmap

If you try them in your code and face any problem, please send us the details of the problem and we will try to help you.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Thursday, June 21, 2012 7:27:48 PM(UTC)

kb7  
kb7

Groups: Registered
Posts: 71


Hi,

I tried these sample codes that you mentioned above. L_MedianFilterBitmap is working fine. But I am not able to get the exact result from L_WindowLevel as in MainDemo example. I am attaching a .tif file. Can you please give me a sample code for obtaining the same result as we get from MainDemo for this image?


Thanks ....
File Attachment(s):
A0_0.tif (175kb) downloaded 36 time(s).
 
#4 Posted : Thursday, June 21, 2012 10:41:13 PM(UTC)

kb7  
kb7

Groups: Registered
Posts: 71


Here is the code that i have used for window level.:

   L_INT nRet;
   L_UINT32 x;
   L_RGBQUAD* ptmp;
   RGBQUAD* pLUT;
   L_INT    nLowBit;
   L_INT    nHighBit;
   L_INT    nLow;
   L_INT    nHigh;
   L_INT nSize;
   BITMAPHANDLE pBitmap;  
   nRet = L_LoadBitmap (TEXT("C:\\Allengers1_1.tif"), &pBitmap, sizeof(BITMAPHANDLE), 16, ORDER_GRAY, NULL, NULL);

    nRet = L_GetMinMaxBits(&pBitmap, &nLowBit, &nHighBit,0);
   if(nRet != SUCCESS)
   {
    ::MessageBox(NULL,L"Not get Bits",L"Information",MB_OK|MB_ICONINFORMATION);
        exit(0);
   }

   nRet = L_GetMinMaxVal(&pBitmap, &nLow, &nHigh,0);
 
   if(nRet != SUCCESS)
   {
    ::MessageBox(NULL,L"Not Get values",L"Information",MB_OK|MB_ICONINFORMATION);
        exit(1);
   }

   nSize = (L_UINT32)(1L<<(nHighBit - nLowBit + 1));
   pLUT = (RGBQUAD *)GlobalAllocPtr(GHND, nSize * sizeof(RGBQUAD));
   ptmp = pLUT;

   for(x=0;x<nSize/2;x++)
   {
      ptmp->rgbRed       = 0;
      ptmp->rgbGreen     = 0;
      ptmp->rgbBlue      = 0;
      ptmp->rgbReserved  = 0;
      ptmp++;
   }

   for(x=nSize/2;x<nSize;x++)
   {
      ptmp->rgbRed       = ((L_UINT16) ((L_UINT32) (x - nLow) * 0xFFFF / (nHigh - nLow)));
      ptmp->rgbGreen     = ptmp->rgbRed;
      ptmp->rgbBlue      = ptmp->rgbGreen;
      ptmp->rgbReserved  = 0;
      ptmp++;
   }

     nRet = L_WindowLevel( &pBitmap, nLowBit, nHighBit,
      pLUT, nSize, WINDOWLEVEL_PAINT | WINDOWLEVEL_PAINT_AND_PROCESSING );

   if(nRet != SUCCESS)
   {
    ::MessageBox(NULL,L"Not Success",L"Information",MB_OK|MB_ICONINFORMATION);
        exit(7);
   }

   nRet = L_SaveBitmap(TEXT("C:\\Result.bmp"), &pBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
   {
       ::MessageBox(NULL,L"Image not saved",L"Information",MB_OK|MB_ICONINFORMATION);
        exit(6);
   }

    GlobalFreePtr(pLUT);


I am also attaching the result which comes up with the above code. But it is not exactly like the one which we obtained from MainDemo.

Please help me resolve this.

Thanks..
 
#5 Posted : Friday, June 22, 2012 7:50:34 PM(UTC)

kb7  
kb7

Groups: Registered
Posts: 71


hi,

Leave it . I got the exact results..

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

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.123 seconds.