Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. Graphics::TBitmap *dest;
  2. RGBTRIPLE *pixelsS, *pixelsD;
  3. TColor color;
  4. Graphics::TBitmap *source = new Graphics::TBitmap;
  5. source->Assign( Image1->Picture->Bitmap );
  6. source->PixelFormat = Image1->Picture->Bitmap->PixelFormat;
  7. /* Etapa I
  8. * Crearea tabelei LUT
  9. */
  10. const int L = 256;
  11. long int LUT[ L ], u, alfa, T1, beta, T2; //L = 256
  12. double gamma = 3.6;
  13. for( int u = 0; u < L; u++ )
  14. LUT[ u ] = pow( u, 1.0/gamma ) * 255.0 / pow( 255, 1.0/gamma );
  15. // crearea si stabilirea unui bitmap destinatie temporar
  16. dest = new Graphics::TBitmap;
  17. dest->Width = source->Width;
  18. dest->Height = source->Height;
  19. dest->PixelFormat = source->PixelFormat;
  20. for( int y = 0; y < dest->Height; y++ )
  21. {
  22. pixelsS = ( RGBTRIPLE* )source->ScanLine[ y ];
  23. pixelsD = ( RGBTRIPLE* )dest->ScanLine[ y ];
  24. for( int x = 0; x < dest->Width; x++ )
  25. {
  26. pixelsD[ x ].rgbtRed = LUT[ pixelsS[ x ].rgbtRed ];
  27. pixelsD[ x ].rgbtGreen = LUT[ pixelsS[ x ].rgbtGreen ];
  28. pixelsD[ x ].rgbtBlue = LUT[ pixelsS[ x ].rgbtBlue ];
  29. }
  30. }
  31. //Asigneaza bitmapul destinatie inapoi catre Image1 si "curata"
  32. Image4->Picture->Bitmap = dest;
  33. //Image2->Canvas->Draw( 0, 0, dest );
  34. //Creare histo Dest - doar desenare
  35. //creareHisto( dest, Chart2, clMaroon, NULL, NULL, NULL, NULL );
  36. delete dest;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement