/// <summary>
/// 参数不能是一位索引
/// </summary>
/// <param name="bmp"></param>
/// <returns></returns>
public Bitmap HoughTransform(Bitmap bmp)
{
//// create filter
//Median Medianfilter = new Median();
//// apply the filter
//Medianfilter.ApplyInPlace(bmp);
Bitmap grayImage;
if (bmp.PixelFormat != PixelFormat.Format16bppGrayScale && bmp.PixelFormat != PixelFormat.Format8bppIndexed)
{
Grayscale grayscalefilter = new Grayscale(0.2125, 0.7154, 0.0721);
grayImage = grayscalefilter.Apply(bmp);
}
else
{
grayImage = bmp;
}
// invert filter
Invert invertfilter = new Invert();
// apply the filter
invertfilter.ApplyInPlace(grayImage);
//// Edge Detector filter
DifferenceEdgeDetector EdgeDetectorfilter = new DifferenceEdgeDetector();
//// apply the filter
EdgeDetectorfilter.ApplyInPlace(grayImage);
//// create filter
Dilatation dilatationfilter = new Dilatation();
//// apply the filter
dilatationfilter.ApplyInPlace(grayImage); return grayImage;
}