Mat mat = opencv_imgcodecs.imread("/sdcard/脚本/1.jpg");
Mat dst = new Mat();
opencv_imgproc.cvtColor(mat,dst,opencv_imgproc.COLOR_BGR2GRAY);
int shape = opencv_imgproc.MORPH_RECT;
Size ksize = new Size(3,3);
Mat kernel = opencv_imgproc.getStructuringElement(shape,ksize);
int op = opencv_imgproc.MORPH_GRADIENT;
Mat dst2 = new Mat();
opencv_imgproc.morphologyEx(dst, dst2, op, kernel);
//Mat dst3 = new Mat();
//opencv_imgproc.Sobel(mat,dst3,-1,1,0);
opencv_imgcodecs.imwrite("/sdcard/test.jpg", dst3);