public static Mat detectEdges(Mat mSource) { Mat mSourceGray = Element.getNewMat(); Mat mDetectedEdges = Element.getNewMat(); int edgeThresh = 1; int lowThreshold = 100; int ratio = 3; int kernelSize = 5; int blurFilterSize = 3; if (mSource.channels() == 1) { mSourceGray = mSource; } else { Imgproc.cvtColor(mSource, mSourceGray, toGray); } Imgproc.blur(mSourceGray, mDetectedEdges, new Size(blurFilterSize, blurFilterSize)); Imgproc.Canny(mDetectedEdges, mDetectedEdges, lowThreshold, lowThreshold * ratio, kernelSize, false); return mDetectedEdges; } //</editor-fold>
@Override public Result process(CvPipeline pipeline) throws Exception { Mat mat = pipeline.getWorkingImage(); Imgproc.Canny(mat, mat, threshold1, threshold2); return null; } }
public FluentCv findEdgesCanny(double threshold1, double threshold2, String... tag) { Imgproc.Canny(mat, mat, threshold1, threshold2); return store(mat, tag); }
@Override public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) { mRgba = inputFrame.rgba(); Imgproc.cvtColor(mRgba, imgGray, Imgproc.COLOR_RGB2GRAY); Imgproc.Canny(imgGray, imgCanny, 50, 150); return imgCanny; }
@Override public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) { mRgba = inputFrame.rgba(); Imgproc.cvtColor(mRgba, imgGray, Imgproc.COLOR_RGB2GRAY); Imgproc.Canny(imgGray, imgCanny, 50, 150); return imgCanny; }
protected void processOperation() { if(sobelString.equals(operation)){ Imgproc.Sobel(originalImage, image, -1, xOrder,yOrder,aperture,1.0, 0.0); // Core.convertScaleAbs(image, image); } else if(laplaceString.equals(operation)){ Imgproc.Laplacian(originalImage, image, -1, aperture, 1.0, 0.0); // Core.convertScaleAbs(image, image); // Imgproc.threshold(image, image, 1, 255, Imgproc.THRESH_BINARY_INV); } else if(cannyString.equals(operation)){ Imgproc.Canny(originalImage, image, lowThreshold, highThreshold, aperture, false); } else if(noneString.equals(operation)){ image = originalImage.clone(); } updateView(image); }
protected void execute() { out = gray(); Imgproc.blur(out, out, new Size(3, 3)); Imgproc.Canny(out, out, min, max); }
Imgproc.Canny(edgesImage_, edgesImage_, high, low); Imgproc.threshold(edgesImage_, edgesImage_, 0, 1, Imgproc.THRESH_BINARY); Log.v(TAG, "Canny took: " + (System.currentTimeMillis() - start));
protected void processOperation() { Imgproc.Canny(originalImage, image, 220, 255, 3, false); Imgproc.threshold(image, image, 100, 255, Imgproc.THRESH_BINARY_INV); Imgproc.distanceTransform(image, image, Imgproc.CV_DIST_L2, 3); image.convertTo(image, CvType.CV_8UC1); Core.multiply(image, new Scalar(20), image); updateView(); }