高斯拉普拉斯锐化(边缘检测)vc实现 -LoG锐化,边缘检测。
void CSDIELSView::OnSharpeningGaussianAndLaplace(){//程序编制:李立宗 lilizong@gmail.com//2012-8-12if(myImage1.IsNull())OnOpenResourceFile();if(!myImage2.IsNull())myImage2.Destroy();if(myImage2.IsNull()){myImage2.Create(myImage1.GetWidth(),myImage1.GetHeight(),24,0);}//COLORREF pixel; int maxY = myImage1.GetHeight();int maxX=myImage1.GetWidth();byte* pRealData;byte* pRealData2;pRealData=(byte*)myImage1.GetBits();pRealData2=(byte*)myImage2.GetBits();int pit=myImage1.GetPitch();int pit2=myImage2.GetPitch();//需要注意,pit和pit2的值并不一样,所以如果使用一个值,会导致不同的结果出现//CString str;//str.Format(TEXT("%d"),pit);//MessageBox(str);//str.Format(TEXT("%d"),pit2);//MessageBox(str);int bitCount=myImage1.GetBPP()/8;int bitCount2=myImage2.GetBPP()/8;int tempR,tempG,tempB;float temp,tempX,tempY;//int M[3][3]={ {1,2,1},{2,4,2},{1,2,1}};int M[5][5]={ {-2,-4,-4,-4,-2