001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.features2d; 005 006import java.util.ArrayList; 007import java.util.List; 008import org.opencv.core.Mat; 009import org.opencv.core.MatOfPoint; 010import org.opencv.features2d.Feature2D; 011import org.opencv.features2d.SimpleBlobDetector; 012import org.opencv.features2d.SimpleBlobDetector_Params; 013import org.opencv.utils.Converters; 014 015// C++: class SimpleBlobDetector 016/** 017 * Class for extracting blobs from an image. : 018 * 019 * The class implements a simple algorithm for extracting blobs from an image: 020 * 021 * 1. Convert the source image to binary images by applying thresholding with several thresholds from 022 * minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between 023 * neighboring thresholds. 024 * 2. Extract connected components from every binary image by findContours and calculate their 025 * centers. 026 * 3. Group centers from several binary images by their coordinates. Close centers form one group that 027 * corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter. 028 * 4. From the groups, estimate final centers of blobs and their radiuses and return as locations and 029 * sizes of keypoints. 030 * 031 * This class performs several filtrations of returned blobs. You should set filterBy\* to true/false 032 * to turn on/off corresponding filtration. Available filtrations: 033 * 034 * <ul> 035 * <li> 036 * <b>By color</b>. This filter compares the intensity of a binary image at the center of a blob to 037 * blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs 038 * and blobColor = 255 to extract light blobs. 039 * </li> 040 * <li> 041 * <b>By area</b>. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive). 042 * </li> 043 * <li> 044 * <b>By circularity</b>. Extracted blobs have circularity 045 * (\(\frac{4*\pi*Area}{perimeter * perimeter}\)) between minCircularity (inclusive) and 046 * maxCircularity (exclusive). 047 * </li> 048 * <li> 049 * <b>By ratio of the minimum inertia to maximum inertia</b>. Extracted blobs have this ratio 050 * between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive). 051 * </li> 052 * <li> 053 * <b>By convexity</b>. Extracted blobs have convexity (area / area of blob convex hull) between 054 * minConvexity (inclusive) and maxConvexity (exclusive). 055 * </li> 056 * </ul> 057 * 058 * Default values of parameters are tuned to extract dark circular blobs. 059 */ 060public class SimpleBlobDetector extends Feature2D { 061 062 protected SimpleBlobDetector(long addr) { super(addr); } 063 064 // internal usage only 065 public static SimpleBlobDetector __fromPtr__(long addr) { return new SimpleBlobDetector(addr); } 066 067 // 068 // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params()) 069 // 070 071 public static SimpleBlobDetector create(SimpleBlobDetector_Params parameters) { 072 return SimpleBlobDetector.__fromPtr__(create_0(parameters.nativeObj)); 073 } 074 075 public static SimpleBlobDetector create() { 076 return SimpleBlobDetector.__fromPtr__(create_1()); 077 } 078 079 080 // 081 // C++: void cv::SimpleBlobDetector::setParams(SimpleBlobDetector_Params params) 082 // 083 084 public void setParams(SimpleBlobDetector_Params params) { 085 setParams_0(nativeObj, params.nativeObj); 086 } 087 088 089 // 090 // C++: SimpleBlobDetector_Params cv::SimpleBlobDetector::getParams() 091 // 092 093 public SimpleBlobDetector_Params getParams() { 094 return new SimpleBlobDetector_Params(getParams_0(nativeObj)); 095 } 096 097 098 // 099 // C++: String cv::SimpleBlobDetector::getDefaultName() 100 // 101 102 public String getDefaultName() { 103 return getDefaultName_0(nativeObj); 104 } 105 106 107 // 108 // C++: vector_vector_Point cv::SimpleBlobDetector::getBlobContours() 109 // 110 111 public List<MatOfPoint> getBlobContours() { 112 List<MatOfPoint> retVal = new ArrayList<MatOfPoint>(); 113 Mat retValMat = new Mat(getBlobContours_0(nativeObj)); 114 Converters.Mat_to_vector_vector_Point(retValMat, retVal); 115 return retVal; 116 } 117 118 119 @Override 120 protected void finalize() throws Throwable { 121 delete(nativeObj); 122 } 123 124 125 126 // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params()) 127 private static native long create_0(long parameters_nativeObj); 128 private static native long create_1(); 129 130 // C++: void cv::SimpleBlobDetector::setParams(SimpleBlobDetector_Params params) 131 private static native void setParams_0(long nativeObj, long params_nativeObj); 132 133 // C++: SimpleBlobDetector_Params cv::SimpleBlobDetector::getParams() 134 private static native long getParams_0(long nativeObj); 135 136 // C++: String cv::SimpleBlobDetector::getDefaultName() 137 private static native String getDefaultName_0(long nativeObj); 138 139 // C++: vector_vector_Point cv::SimpleBlobDetector::getBlobContours() 140 private static native long getBlobContours_0(long nativeObj); 141 142 // native support for java finalize() 143 private static native void delete(long nativeObj); 144 145}