///<summery> ///Finds global minimum and maximum in array or subarray. ///</summery> public static void CVMinMaxLoc(CVImage image, out double minVal, out double maxVal, out System.Drawing.Point minLocation, out System.Drawing.Point maxLocation, CVArr mask) { // Prepare out paramaters: __CvPoint min_loc = new __CvPoint(); __CvPoint max_loc = new __CvPoint(); double min_val = -1; double max_val = -1; //CvArr tempMask = 0; //if (mask != nullptr) { // tempMask = mask->Array; //} //CVArr tempMask = mask.Array; minLocation = new System.Drawing.Point(0, 0); maxLocation = new System.Drawing.Point(0, 0); // Native call to openCV cvMinMaxLoc: PInvoke.cvMinMaxLoc( new __CvArrPtr(image), ref min_val, ref max_val, ref min_loc, ref max_loc, new __CvArrPtr(mask)); minVal = min_val; maxVal = max_val; minLocation = new System.Drawing.Point(min_loc.x, min_loc.y); maxLocation = new System.Drawing.Point(max_loc.x, max_loc.y); }
///<summery> ///Finds global minimum and maximum in array or subarray. ///</summery> public static void CVMinMaxLoc(CVImage image, out double minVal, out double maxVal, out System.Drawing.Point minLocation, out System.Drawing.Point maxLocation, CVArr mask) { // Prepare out paramaters: __CvPoint min_loc = new __CvPoint(); __CvPoint max_loc = new __CvPoint(); double min_val = -1; double max_val = -1; //CvArr tempMask = 0; //if (mask != nullptr) { // tempMask = mask->Array; //} //CVArr tempMask = mask.Array; minLocation = new System.Drawing.Point(0, 0); maxLocation = new System.Drawing.Point(0, 0); // Native call to openCV cvMinMaxLoc: PInvoke.cvMinMaxLoc( new __CvArrPtr(image), out min_val, out max_val, out min_loc, out max_loc, new __CvArrPtr(mask)); CVUtils.CheckLastError(); minVal = min_val; maxVal = max_val; minLocation = new System.Drawing.Point(min_loc.x, min_loc.y); maxLocation = new System.Drawing.Point(max_loc.x, max_loc.y); }
/// <summary> /// Builds the whole pyramid at once. Output array of CvMat headers (levels[*]) // is initialized with the headers of subsequent pyramid levels /// TODO: Remove 'container' argument and return an object /// </summary> public void CalcPyramid(CVArr container, CVMat levels, int level_count, PyrFilter filter) { PInvoke.cvCalcPyramid(new __CvImagePtr(this), new __CvArrPtr(container), levels.Ptr, level_count, (int)filter); }
/// <summary> /// Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y) /// TODO: Remove 'sum' argument and return a CVArr object /// </summary> public void Integral(CVArr sum, CVArr sqsum, CVArr titled_sum) { PInvoke.cvIntegral(new __CvImagePtr(this), new __CvArrPtr(sum), new __CvArrPtr(sqsum), new __CvArrPtr(titled_sum)); }
public __CvArrPtr(CVArr arr) { ptr = (arr != null? arr.Ptr : IntPtr.Zero); }
/// <summary /// Segments image using seed "markers" /// </summary> public void Watershed(CVArr markers) { PInvoke.cvWatershed(new __CvArrPtr(this), new __CvArrPtr(markers)); CVUtils.CheckLastError(); }
///<summary> /// Warps image with affine transform /// TODO: Remove 'dst' argument and return a CVImage object ///</summary> public void WarpAffine(CVArr dst, CVMat map_matrix, WarpFlags flags, CVScalar fillval) { PInvoke.cvWarpAffine(new __CvArrPtr(this), new __CvArrPtr(dst), new __CvMatPtr(map_matrix), (int)flags, new __CvScalar(fillval)); }
public void Laplace(CVArr dst) { Laplace(dst, 3); }
/// <summary> /// Inpaints the selected region in the image /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Inpaint(CVArr inpaint_mask, CVArr dst, double inpaintRange, int flags) { PInvoke.cvInpaint(new __CvArrPtr(this), new __CvArrPtr(inpaint_mask), new __CvArrPtr(dst), inpaintRange, flags); }
public void CalcPyramid(CVArr container, CVMat levels, int level_count) { CalcPyramid(container, levels, level_count, PyrFilter.CV_GAUSSIAN_5x5); }
/// <summary> /// Builds the whole pyramid at once. Output array of CvMat headers (levels[*]) // is initialized with the headers of subsequent pyramid levels /// TODO: Remove 'container' argument and return an object /// </summary> public void CalcPyramid(CVArr container, CVMat levels, int level_count, PyrFilter filter) { PInvoke.cvCalcPyramid(new __CvImagePtr(this), new __CvArrPtr(container), levels.Ptr, level_count, (int)filter); CVUtils.CheckLastError(); }
/// <summary> /// Resizes image (input array is resized to fit the destination array) /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Resize(CVArr dst, ResizeInterpolation interpolation) { PInvoke.cvResize(new __CvArrPtr(this), new __CvArrPtr(dst), (int)interpolation); CVUtils.CheckLastError(); }
/// <summary> /// Calculates the image Laplacian: (d2/dx + d2/dy)I /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Laplace(CVArr dst, int aperture_size) { PInvoke.cvLaplace(new __CvArrPtr(this), new __CvArrPtr(dst), aperture_size); CVUtils.CheckLastError(); }
/// <summary> /// Calculates an image derivative using generalized Sobel /// (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator. /// Scharr can be used only for the first dx or dy derivative /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Sobel(CVArr dst, int xorder, int yorder, int aperture_size) { PInvoke.cvSobel(new __CvArrPtr(this), new __CvArrPtr(dst), xorder, yorder, aperture_size); CVUtils.CheckLastError(); }
/// <summary> /// Filters image using meanshift algorithm /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void PyrMeanShiftFiltering(CVArr dst, double sp, double sr) { PyrMeanShiftFiltering(dst, sp, sr, 1); }
public void PyrMeanShiftFiltering(CVArr dst, double sp, double sr, int max_level, CVTermCriteria termcrit) { PInvoke.cvPyrMeanShiftFiltering(new __CvArrPtr(this), new __CvArrPtr(dst), sp, sr, max_level, termcrit); }
public void CvtColor(CVArr dst, ColorSpace colorSpace) { PInvoke.cvCvtColor(new __CvArrPtr(this), new __CvArrPtr(dst), (int)colorSpace); }
public void Sobel(CVArr dst, int xorder, int yorder) { Sobel(dst, xorder, yorder, 3); }
/// <summary> /// Inpaints the selected region in the image /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Inpaint(CVArr inpaint_mask, CVArr dst, double inpaintRange, int flags) { PInvoke.cvInpaint(new __CvArrPtr(this), new __CvArrPtr(inpaint_mask), new __CvArrPtr(dst), inpaintRange, flags); CVUtils.CheckLastError(); }
/// <summary> /// Resizes image (input array is resized to fit the destination array) /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Resize(CVArr dst, ResizeInterpolation interpolation) { PInvoke.cvResize(new __CvArrPtr(this), new __CvArrPtr(dst), (int)interpolation); }
/// <summary> /// Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y) /// TODO: Remove 'sum' argument and return a CVArr object /// </summary> public void Integral(CVArr sum, CVArr sqsum, CVArr titled_sum) { PInvoke.cvIntegral(new __CvImagePtr(this), new __CvArrPtr(sum), new __CvArrPtr(sqsum), new __CvArrPtr(titled_sum)); CVUtils.CheckLastError(); }
public void WarpAffine(CVArr dst, CVMat map_matrix) { WarpAffine(dst, map_matrix, WarpFlags.CV_WARP_FILL_OUTLIERS | WarpFlags.CV_WARP_INVERSE_MAP); }
public void Integral(CVArr sum, CVArr sqsum) { Integral(sum, sqsum, null); }
public void PyrMeanShiftFiltering(CVArr dst, double sp, double sr, int max_level) { PyrMeanShiftFiltering(dst, sp, sr, max_level, new CVTermCriteria(5, 1.0)); }
public void PyrMeanShiftFiltering(CVArr dst, double sp, double sr, int max_level, CVTermCriteria termcrit) { PInvoke.cvPyrMeanShiftFiltering(new __CvArrPtr(this), new __CvArrPtr(dst), sp, sr, max_level, termcrit); CVUtils.CheckLastError(); }
/// <summary /// Segments image using seed "markers" /// </summary> public void Watershed(CVArr markers) { PInvoke.cvWatershed(new __CvArrPtr(this), new __CvArrPtr(markers)); }
public void Resize(CVArr dst) { Resize(dst, ResizeInterpolation.CV_INTER_LINEAR); }
/// <summary> /// Calculates an image derivative using generalized Sobel /// (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator. /// Scharr can be used only for the first dx or dy derivative /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Sobel(CVArr dst, int xorder, int yorder, int aperture_size) { PInvoke.cvSobel(new __CvArrPtr(this), new __CvArrPtr(dst), xorder, yorder, aperture_size); }
/// <summary> /// Calculates the image Laplacian: (d2/dx + d2/dy)I /// TODO: Remove 'dst' argument and return a CVImage object /// </summary> public void Laplace(CVArr dst, int aperture_size) { PInvoke.cvLaplace(new __CvArrPtr(this), new __CvArrPtr(dst), aperture_size); }
///<summary> /// Warps image with affine transform /// TODO: Remove 'dst' argument and return a CVImage object ///</summary> public void WarpAffine(CVArr dst, CVMat map_matrix, WarpFlags flags, CVScalar fillval) { PInvoke.cvWarpAffine(new __CvArrPtr(this), new __CvArrPtr(dst), new __CvMatPtr(map_matrix), (int)flags, new __CvScalar(fillval)); CVUtils.CheckLastError(); }
public void WarpAffine(CVArr dst, CVMat map_matrix, WarpFlags flags) { WarpAffine(dst, map_matrix, flags, new CVScalar()); }
internal struct __CvArrPtr { public IntPtr ptr; public __CvArrPtr(CVArr arr) { ptr = (arr != null? arr.Ptr : IntPtr.Zero); }