其他分享
首页 > 其他分享> > opencv_Sobel

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

标签:imgproc,Mat,Sobel,dst,dst3,opencv,new
来源: https://blog.csdn.net/qq_43533807/article/details/120925766