Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GaussianBlur #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 29 additions & 1 deletion src/SharpCV/APIs/cv2.imgproc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,20 @@ public Mat medianBlur(Mat src, int kSize)
cv2_native_api.imgproc_medianBlur(src.InputArray, dst.OutputArray, kSize);
return dst;
}

public Mat GaussianBlur(Mat src,
Size kSize,
double sigmaX, double sigmaY,
BorderTypes borderType = BorderTypes.BORDER_DEFAULT)
{
var dst = new Mat();

cv2_native_api.imgproc_GaussianBlur(src.InputArray,
dst.OutputArray,
kSize,
sigmaX, sigmaY,
borderType);
return dst;
}
public Mat filter2D(Mat src,
MatType ddepth,
Mat kernel,
Expand Down Expand Up @@ -358,5 +371,20 @@ public Mat medianBlur(Mat src, int kSize)
borderType);
return dst;
}

public Mat Sobel(Mat src, MatType ddepth,
int dx, int dy, int kSize,
double scale, double delta,
BorderTypes borderType = BorderTypes.BORDER_DEFAULT)
{
var dst = new Mat();

cv2_native_api.imgproc_Sobel(src.InputArray,
dst.OutputArray,
ddepth,dx,dy,
kSize, scale, delta,
borderType);
return dst;
}
}
}
6 changes: 6 additions & 0 deletions src/SharpCV/NativeAPIs/cv2_native_api.core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@ internal partial class cv2_native_api
internal static extern void core_split(IntPtr src, IntPtr mv);
[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void core_vconcat2(IntPtr mat1, IntPtr mat2, IntPtr dst);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void core_convertScaleAbs(IntPtr src, IntPtr dst, double alpha, double beta);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void core_addWeighted(IntPtr src1, double alpha, IntPtr src2, double beta, double gamma, IntPtr dst, int dtype);
}
}
6 changes: 6 additions & 0 deletions src/SharpCV/NativeAPIs/cv2_native_api.imgproc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ internal partial class cv2_native_api
[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void imgproc_medianBlur(IntPtr src, IntPtr dst, int kSize);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void imgproc_GaussianBlur(IntPtr src, IntPtr dst, Size kSize, double sigmaX, double sigmaY, BorderTypes borderType);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void imgproc_filter2D(IntPtr src, IntPtr dst, MatType ddepth, IntPtr kernel, Point anchor,
double delta, BorderTypes borderType);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void imgproc_blur(IntPtr src, IntPtr dst, Size kSize, Point anchor, BorderTypes borderType);

[DllImport(OpenCvDllName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void imgproc_Sobel(IntPtr src, IntPtr dst, MatType ddepth, int dx, int dy, int kSize, double scale, double delta, BorderTypes borderType);
}
}