使用cximage 做亮度调节 我搞了好久都是直接变化成灰度求指教
自己做了一个小程序 需要亮度调节 界面都好了
使用cximage 做亮度调节 我搞了好久都是直接变化程度求指教
void CImageProcessingDoc::OnProcessBrightness()
{
// TODO: 这里执行亮度变化
if (m_pImage) {
DlgBrightnessOption dlg;
if (dlg.DoModal() == IDOK) {
// write your own code
// for applying your effect, you must use m_pImage
// this code is a simple example for manufacturing image : grayscaling
int nPlusMinus = dlg.m_nPlusMinus;
BYTE byModifyValue = dlg.m_byModifyValue;
DWORD width = m_pImage->GetWidth();
DWORD height = m_pImage->GetHeight();
RGBQUAD color;
RGBQUAD newcolor;
for (DWORD y = 0; y < height; y++) {
for (DWORD x = 0; x < width; x++) {
color = m_pImage->GetPixelColor(x, y);
newcolor.rgbBlue = (BYTE)RGB2GRAY(color.rgbRed, color.rgbGreen, color.rgbBlue);
newcolor.rgbGreen = (BYTE)RGB2GRAY(color.rgbRed, color.rgbGreen, color.rgbBlue);
newcolor.rgbRed = (BYTE)RGB2GRAY(color.rgbRed, color.rgbGreen, color.rgbBlue);
m_pImage->SetPixelColor(x, y, newcolor);
}
}
// 这里调试
BYTE a = 255;
BYTE b = 1;
int c = 10;
BYTE r;
r = a + b;
r = a + c;
r = b + c;
}
}
CalculateHistogram();
UpdateAllViews(NULL);
}
需要全部文件的可以QQ联系:17831500