현실감각 0% :: 현실감각 0%

소스예제 퍼온거 2013. 7. 3. 15:59

openCVSharp LoG와 DoG 산출



IplImage imgSrc = Cv.LoadImage(openFileDialog1.FileName);
IplImage imgGray = Cv.CreateImage(imgSrc.Size, BitDepth.U8, 1);
IplImage imgGaus1 = Cv.CreateImage(imgSrc.Size, BitDepth.U8, 1);
IplImage imgGaus2 = Cv.CreateImage(imgSrc.Size, BitDepth.U8, 1);
IplImage LoG = Cv.CreateImage(imgSrc.Size, BitDepth.F32, 1);
IplImage DoG = Cv.CreateImage(imgSrc.Size, BitDepth.U8, 1);
Cv.CvtColor(imgSrc, imgGray, ColorConversion.RgbToGray);

Cv.Smooth(imgGray, imgGaus1, SmoothType.Gaussian, trackBar1.Value, 0, 0, 0);
Cv.Smooth(imgGray, imgGaus2, SmoothType.Gaussian, trackBar2.Value, 0, 0, 0);

Cv.Laplace(imgGaus1, LoG, ApertureSize.Size7);
Cv.Sub(imgGray, imgGaus2, DoG);
Cv.MaxS(LoG, 0, LoG);

picturebox1.ImageIpl = imgSrc;
picturebox2.ImageIpl = LoG;
picturebox3.ImageIpl = DoG;