关于积分投影图
我在做图像的积分投影时,得到了投影曲线。可是原始的积分投影图并不清晰,程序上怎么样修改,才能使曲线变得更加清晰?效果图,请参考附件。请各位指教,谢谢。
_分投影_.rar
(8.77 KB)
程序如下:
void CHProjDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CString str;
LONG i;
LONG iMaxCount = 0;
/// CPaintDC dc(this);
CWnd* pWnd = GetDlgItem(IDC_COORD);
CDC* pDC = pWnd->GetDC();
pWnd->Invalidate();
pWnd->UpdateWindow();
pDC->Rectangle(0,0,330,300);
CPen* pPenRed = new CPen;
pPenRed->CreatePen(PS_SOLID,1,RGB(255,0,0));
CPen* pPenBlue = new CPen;
pPenBlue->CreatePen(PS_SOLID,1,RGB(0,0,255));
CPen* pPenGreen = new CPen;
pPenGreen->CreatePen(PS_SOLID,1,RGB(0,255,0));
CGdiObject* pOldPen=pDC->SelectObject(pPenRed);
pDC->MoveTo(10,10);
pDC->LineTo(10,280);
pDC->LineTo(320,280);
str.Format("0");
pDC->TextOut(10,283,str);
str.Format("50");
pDC->TextOut(60,283,str);
str.Format("100");
pDC->TextOut(110,283,str);
str.Format("150");
pDC->TextOut(160,283,str);
str.Format("200");
pDC->TextOut(210,283,str);
str.Format("255");
pDC->TextOut(265,283,str);
for(i=0; i<256; i+=5)
{
if((i&1) == 0)
{
pDC->MoveTo(i+10,280);
pDC->LineTo(i+10,284);
}
else
{
pDC->MoveTo(i+10,280);
pDC->LineTo(i+10,282);
}
}
pDC->MoveTo(315,275);
pDC->LineTo(320,280);
pDC->LineTo(315,285);
pDC->MoveTo(10,10);
pDC->LineTo(5,15);
pDC->MoveTo(10,10);
pDC->LineTo(15,15);
pDC->SelectObject(pPenBlue);
for(i=0; i<m_Width; i++)
{
pDC->MoveTo(i+10,280);
pDC->LineTo(i+10,281 - (int)(m_hCount[i]));
}
pDC->SelectObject(pOldPen);
delete pPenRed;
delete pPenBlue;
delete pPenGreen;
// Do not call CDialog::OnPaint() for painting messages
}