OpenCvSharp.Cv2.Laplacian C# (CSharp) Method

Laplacian() public static method

Calculates the Laplacian of an image
public static Laplacian ( InputArray src, OutputArray dst, MatType ddepth, int ksize = 1, double scale = 1, double delta, BorderTypes borderType = BorderTypes.Default ) : void
src InputArray Source image
dst OutputArray Destination image; will have the same size and the same number of channels as src
ddepth MatType The desired depth of the destination image
ksize int The aperture size used to compute the second-derivative filters
scale double The optional scale factor for the computed Laplacian values (by default, no scaling is applied
delta double The optional delta value, added to the results prior to storing them in dst
borderType BorderTypes The pixel extrapolation method
return void
        public static void Laplacian(
            InputArray src, OutputArray dst, MatType ddepth,
            int ksize = 1, double scale = 1, double delta = 0, 
            BorderTypes borderType = BorderTypes.Default)
        {
            if (src == null)
                throw new ArgumentNullException(nameof(src));
            if (dst == null)
                throw new ArgumentNullException(nameof(dst));
            src.ThrowIfDisposed();
            dst.ThrowIfNotReady();
            NativeMethods.imgproc_Laplacian(src.CvPtr, dst.CvPtr, ddepth, ksize, scale, delta, (int)borderType);
            GC.KeepAlive(src);
            dst.Fix();
        }
        #endregion

Usage Example

コード例 #1
0
        private Point getEyePosition(Mat eye)
        {
            Point result;

            Cv2.Blur(eye, eye, new Size(5, 5));
            Cv2.Laplacian(eye, eye, MatType.CV_64F);
            Cv2.MinMaxLoc(eye, out _, out _, out result, out _);
            return(result);
        }
Cv2