// JP opened flex table

Click to See Complete Forum and Search --> : question , help with image


celtics
November 27th, 2003, 12:21 PM
Sorry, for multiple posts here. i am new and made errors.
this is for my biology project.

my B&W image has gray scale problem. it looks good for most part. needs to be smoothed uniformaly. Dark areas need to be dark uniformaly without any fuzziness or impurities of other colors. I do not know the image processing terms for it.(maybe gamma is the proper term for it).
How to (modify)Or(add to)) this header to improve maybe contrast,gamma?. MFC/SDI.
Celtics


LPBITMAPINFO PbmiHeader = (LPBITMAPINFO)new BYTE[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
PbmiHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
PbmiHeader->bmiHeader.biWidth = Width;
PbmiHeader->bmiHeader.biHeight = Height;
PbmiHeader->bmiHeader.biPlanes = 1;
PbmiHeader->bmiHeader.biBitCount = 8;
PbmiHeader->bmiHeader.biCompression = 0;
PbmiHeader->bmiHeader.biSizeImage = 0;
PbmiHeader->bmiHeader.biXPelsPerMeter = 0;
PbmiHeader->bmiHeader.biYPelsPerMeter = 0;
PbmiHeader->bmiHeader.biClrUsed = 0;
PbmiHeader->bmiHeader.biClrImportant = 0;
for(int i=0; i<256; i++) {
PbmiHeader->bmiColors[i].rgbBlue = i;
PbmiHeader->bmiColors[i].rgbGreen = i;
PbmiHeader->bmiColors[i].rgbRed = i;
PbmiHeader->bmiColors[i].rgbReserved = 0;
}
HDC hdc = pDC->GetSafeHdc();
StretchDIBits( hdc, 0, 0,
Width1,
Height1,
0, 0,
Width,
Height,
data,
PbmiHeader,
DIB_RGB_COLORS,
SRCCOPY );

Deniz
November 27th, 2003, 06:26 PM
I use this and it works well without filters:

float av;
int iR, iG, iB;

//Get the RGB values and put them in the above var's

av = (float)((0.3 * iR) + (0.59 * iG) + (0.11 * iB));

//your new B&W colour is now:

RGB((int)av, (int)av, (int)av);

celtics
November 27th, 2003, 07:42 PM
how to incoporate these av calucation into the header in my question post?.

Deniz
December 1st, 2003, 07:21 PM
Do it in the for loop where you have access to the RGB values.

celtics
December 1st, 2003, 11:17 PM
can you show me exactly how?. this is the last challenge left fo rme.
celtics

//JP added flex table