opencv_Sobel

        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);

上一篇:OpenCV+CUDA学习5---Sobel算法


下一篇:边缘检测(sobel、canny、log)