private BitmapHoughTransFormLine(Bitmap bmp)
{
Mat rgbMat = new Mat(); //存储原图像的矩阵
Mat grayMat = new Mat(); //存储灰度图像的矩阵
Mat lineMat = new Mat(); //存储检测出的直线坐标的矩阵,每个element有4个通道,第1、2个通道为直线的1个端点,第3、4个通道为直线的另1个端点
Utils.bitmapToMat(bmp, rgbMat);
Imgproc.cvtColor(rgbMat,grayMat, Imgproc.COLOR_RGB2GRAY); //灰度化
Imgproc.Canny(grayMat, grayMat,50, 200); //Canny边缘检测
/* Hough变换标记直线
* public static void HoughLinesP(Matimage, Mat lines, double rho, double theta, int threshold)
* image - 8-bit, single-channel binary source image. The image may bemodified by the function.
* lines - Output vector of lines. Each line is represented by a 4-elementvector (x_1, y_1, x_2, y_2),
* where (x_1,y_1) and (x_2, y_2) arethe ending points of each detected line segment.
* rho - Distance