Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Graphics::TBitmap *dest;
- RGBTRIPLE *pixelsS, *pixelsD;
- TColor color;
- Graphics::TBitmap *source = new Graphics::TBitmap;
- source->Assign( Image1->Picture->Bitmap );
- source->PixelFormat = Image1->Picture->Bitmap->PixelFormat;
- /* Etapa I
- * Crearea tabelei LUT
- */
- const int L = 256;
- long int LUT[ L ], u, alfa, T1, beta, T2; //L = 256
- double gamma = 3.6;
- for( int u = 0; u < L; u++ )
- LUT[ u ] = pow( u, 1.0/gamma ) * 255.0 / pow( 255, 1.0/gamma );
- // crearea si stabilirea unui bitmap destinatie temporar
- dest = new Graphics::TBitmap;
- dest->Width = source->Width;
- dest->Height = source->Height;
- dest->PixelFormat = source->PixelFormat;
- for( int y = 0; y < dest->Height; y++ )
- {
- pixelsS = ( RGBTRIPLE* )source->ScanLine[ y ];
- pixelsD = ( RGBTRIPLE* )dest->ScanLine[ y ];
- for( int x = 0; x < dest->Width; x++ )
- {
- pixelsD[ x ].rgbtRed = LUT[ pixelsS[ x ].rgbtRed ];
- pixelsD[ x ].rgbtGreen = LUT[ pixelsS[ x ].rgbtGreen ];
- pixelsD[ x ].rgbtBlue = LUT[ pixelsS[ x ].rgbtBlue ];
- }
- }
- //Asigneaza bitmapul destinatie inapoi catre Image1 si "curata"
- Image4->Picture->Bitmap = dest;
- //Image2->Canvas->Draw( 0, 0, dest );
- //Creare histo Dest - doar desenare
- //creareHisto( dest, Chart2, clMaroon, NULL, NULL, NULL, NULL );
- delete dest;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement