001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.objdetect;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfDouble;
010import org.opencv.core.MatOfFloat;
011import org.opencv.core.MatOfPoint;
012import org.opencv.core.MatOfRect;
013import org.opencv.core.Size;
014import org.opencv.utils.Converters;
015
016// C++: class HOGDescriptor
017/**
018 * Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.
019 *
020 * the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs CITE: Dalal2005 .
021 *
022 * useful links:
023 *
024 * https://hal.inria.fr/inria-00548512/document/
025 *
026 * https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
027 *
028 * https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor
029 *
030 * http://www.learnopencv.com/histogram-of-oriented-gradients
031 *
032 * http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial
033 */
034public class HOGDescriptor {
035
036    protected final long nativeObj;
037    protected HOGDescriptor(long addr) { nativeObj = addr; }
038
039    public long getNativeObjAddr() { return nativeObj; }
040
041    // internal usage only
042    public static HOGDescriptor __fromPtr__(long addr) { return new HOGDescriptor(addr); }
043
044    // C++: enum <unnamed>
045    public static final int
046            DEFAULT_NLEVELS = 64;
047
048
049    // C++: enum DescriptorStorageFormat (cv.HOGDescriptor.DescriptorStorageFormat)
050    public static final int
051            DESCR_FORMAT_COL_BY_COL = 0,
052            DESCR_FORMAT_ROW_BY_ROW = 1;
053
054
055    // C++: enum HistogramNormType (cv.HOGDescriptor.HistogramNormType)
056    public static final int
057            L2Hys = 0;
058
059
060    //
061    // C++:   cv::HOGDescriptor::HOGDescriptor()
062    //
063
064    /**
065     * Creates the HOG descriptor and detector with default parameters.
066     *
067     *     aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
068     */
069    public HOGDescriptor() {
070        nativeObj = HOGDescriptor_0();
071    }
072
073
074    //
075    // C++:   cv::HOGDescriptor::HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture = 1, double _winSigma = -1, HOGDescriptor_HistogramNormType _histogramNormType = HOGDescriptor::L2Hys, double _L2HysThreshold = 0.2, bool _gammaCorrection = false, int _nlevels = HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient = false)
076    //
077
078    /**
079     *
080     *     @param _winSize sets winSize with given value.
081     *     @param _blockSize sets blockSize with given value.
082     *     @param _blockStride sets blockStride with given value.
083     *     @param _cellSize sets cellSize with given value.
084     *     @param _nbins sets nbins with given value.
085     *     @param _derivAperture sets derivAperture with given value.
086     *     @param _winSigma sets winSigma with given value.
087     *     @param _histogramNormType sets histogramNormType with given value.
088     *     @param _L2HysThreshold sets L2HysThreshold with given value.
089     *     @param _gammaCorrection sets gammaCorrection with given value.
090     *     @param _nlevels sets nlevels with given value.
091     *     @param _signedGradient sets signedGradient with given value.
092     */
093    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels, boolean _signedGradient) {
094        nativeObj = HOGDescriptor_1(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels, _signedGradient);
095    }
096
097    /**
098     *
099     *     @param _winSize sets winSize with given value.
100     *     @param _blockSize sets blockSize with given value.
101     *     @param _blockStride sets blockStride with given value.
102     *     @param _cellSize sets cellSize with given value.
103     *     @param _nbins sets nbins with given value.
104     *     @param _derivAperture sets derivAperture with given value.
105     *     @param _winSigma sets winSigma with given value.
106     *     @param _histogramNormType sets histogramNormType with given value.
107     *     @param _L2HysThreshold sets L2HysThreshold with given value.
108     *     @param _gammaCorrection sets gammaCorrection with given value.
109     *     @param _nlevels sets nlevels with given value.
110     */
111    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels) {
112        nativeObj = HOGDescriptor_2(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels);
113    }
114
115    /**
116     *
117     *     @param _winSize sets winSize with given value.
118     *     @param _blockSize sets blockSize with given value.
119     *     @param _blockStride sets blockStride with given value.
120     *     @param _cellSize sets cellSize with given value.
121     *     @param _nbins sets nbins with given value.
122     *     @param _derivAperture sets derivAperture with given value.
123     *     @param _winSigma sets winSigma with given value.
124     *     @param _histogramNormType sets histogramNormType with given value.
125     *     @param _L2HysThreshold sets L2HysThreshold with given value.
126     *     @param _gammaCorrection sets gammaCorrection with given value.
127     */
128    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection) {
129        nativeObj = HOGDescriptor_3(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection);
130    }
131
132    /**
133     *
134     *     @param _winSize sets winSize with given value.
135     *     @param _blockSize sets blockSize with given value.
136     *     @param _blockStride sets blockStride with given value.
137     *     @param _cellSize sets cellSize with given value.
138     *     @param _nbins sets nbins with given value.
139     *     @param _derivAperture sets derivAperture with given value.
140     *     @param _winSigma sets winSigma with given value.
141     *     @param _histogramNormType sets histogramNormType with given value.
142     *     @param _L2HysThreshold sets L2HysThreshold with given value.
143     */
144    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold) {
145        nativeObj = HOGDescriptor_4(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold);
146    }
147
148    /**
149     *
150     *     @param _winSize sets winSize with given value.
151     *     @param _blockSize sets blockSize with given value.
152     *     @param _blockStride sets blockStride with given value.
153     *     @param _cellSize sets cellSize with given value.
154     *     @param _nbins sets nbins with given value.
155     *     @param _derivAperture sets derivAperture with given value.
156     *     @param _winSigma sets winSigma with given value.
157     *     @param _histogramNormType sets histogramNormType with given value.
158     */
159    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType) {
160        nativeObj = HOGDescriptor_5(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType);
161    }
162
163    /**
164     *
165     *     @param _winSize sets winSize with given value.
166     *     @param _blockSize sets blockSize with given value.
167     *     @param _blockStride sets blockStride with given value.
168     *     @param _cellSize sets cellSize with given value.
169     *     @param _nbins sets nbins with given value.
170     *     @param _derivAperture sets derivAperture with given value.
171     *     @param _winSigma sets winSigma with given value.
172     */
173    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma) {
174        nativeObj = HOGDescriptor_6(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma);
175    }
176
177    /**
178     *
179     *     @param _winSize sets winSize with given value.
180     *     @param _blockSize sets blockSize with given value.
181     *     @param _blockStride sets blockStride with given value.
182     *     @param _cellSize sets cellSize with given value.
183     *     @param _nbins sets nbins with given value.
184     *     @param _derivAperture sets derivAperture with given value.
185     */
186    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture) {
187        nativeObj = HOGDescriptor_7(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture);
188    }
189
190    /**
191     *
192     *     @param _winSize sets winSize with given value.
193     *     @param _blockSize sets blockSize with given value.
194     *     @param _blockStride sets blockStride with given value.
195     *     @param _cellSize sets cellSize with given value.
196     *     @param _nbins sets nbins with given value.
197     */
198    public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins) {
199        nativeObj = HOGDescriptor_8(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins);
200    }
201
202
203    //
204    // C++:   cv::HOGDescriptor::HOGDescriptor(String filename)
205    //
206
207    /**
208     *
209     *
210     *     Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.
211     *     @param filename The file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.
212     */
213    public HOGDescriptor(String filename) {
214        nativeObj = HOGDescriptor_9(filename);
215    }
216
217
218    //
219    // C++:  size_t cv::HOGDescriptor::getDescriptorSize()
220    //
221
222    /**
223     * Returns the number of coefficients required for the classification.
224     * @return automatically generated
225     */
226    public long getDescriptorSize() {
227        return getDescriptorSize_0(nativeObj);
228    }
229
230
231    //
232    // C++:  bool cv::HOGDescriptor::checkDetectorSize()
233    //
234
235    /**
236     * Checks if detector size equal to descriptor size.
237     * @return automatically generated
238     */
239    public boolean checkDetectorSize() {
240        return checkDetectorSize_0(nativeObj);
241    }
242
243
244    //
245    // C++:  double cv::HOGDescriptor::getWinSigma()
246    //
247
248    /**
249     * Returns winSigma value
250     * @return automatically generated
251     */
252    public double getWinSigma() {
253        return getWinSigma_0(nativeObj);
254    }
255
256
257    //
258    // C++:  void cv::HOGDescriptor::setSVMDetector(Mat svmdetector)
259    //
260
261    /**
262     * Sets coefficients for the linear SVM classifier.
263     *     @param svmdetector coefficients for the linear SVM classifier.
264     */
265    public void setSVMDetector(Mat svmdetector) {
266        setSVMDetector_0(nativeObj, svmdetector.nativeObj);
267    }
268
269
270    //
271    // C++:  bool cv::HOGDescriptor::load(String filename, String objname = String())
272    //
273
274    /**
275     * loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file
276     *     @param filename Name of the file to read.
277     *     @param objname The optional name of the node to read (if empty, the first top-level node will be used).
278     * @return automatically generated
279     */
280    public boolean load(String filename, String objname) {
281        return load_0(nativeObj, filename, objname);
282    }
283
284    /**
285     * loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file
286     *     @param filename Name of the file to read.
287     * @return automatically generated
288     */
289    public boolean load(String filename) {
290        return load_1(nativeObj, filename);
291    }
292
293
294    //
295    // C++:  void cv::HOGDescriptor::save(String filename, String objname = String())
296    //
297
298    /**
299     * saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file
300     *     @param filename File name
301     *     @param objname Object name
302     */
303    public void save(String filename, String objname) {
304        save_0(nativeObj, filename, objname);
305    }
306
307    /**
308     * saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file
309     *     @param filename File name
310     */
311    public void save(String filename) {
312        save_1(nativeObj, filename);
313    }
314
315
316    //
317    // C++:  void cv::HOGDescriptor::compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
318    //
319
320    /**
321     * Computes HOG descriptors of given image.
322     *     @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
323     *     @param descriptors Matrix of the type CV_32F
324     *     @param winStride Window stride. It must be a multiple of block stride.
325     *     @param padding Padding
326     *     @param locations Vector of Point
327     */
328    public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding, MatOfPoint locations) {
329        Mat descriptors_mat = descriptors;
330        Mat locations_mat = locations;
331        compute_0(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height, padding.width, padding.height, locations_mat.nativeObj);
332    }
333
334    /**
335     * Computes HOG descriptors of given image.
336     *     @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
337     *     @param descriptors Matrix of the type CV_32F
338     *     @param winStride Window stride. It must be a multiple of block stride.
339     *     @param padding Padding
340     */
341    public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding) {
342        Mat descriptors_mat = descriptors;
343        compute_1(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height, padding.width, padding.height);
344    }
345
346    /**
347     * Computes HOG descriptors of given image.
348     *     @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
349     *     @param descriptors Matrix of the type CV_32F
350     *     @param winStride Window stride. It must be a multiple of block stride.
351     */
352    public void compute(Mat img, MatOfFloat descriptors, Size winStride) {
353        Mat descriptors_mat = descriptors;
354        compute_2(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height);
355    }
356
357    /**
358     * Computes HOG descriptors of given image.
359     *     @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
360     *     @param descriptors Matrix of the type CV_32F
361     */
362    public void compute(Mat img, MatOfFloat descriptors) {
363        Mat descriptors_mat = descriptors;
364        compute_3(nativeObj, img.nativeObj, descriptors_mat.nativeObj);
365    }
366
367
368    //
369    // C++:  void cv::HOGDescriptor::detect(Mat img, vector_Point& foundLocations, vector_double& weights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), vector_Point searchLocations = std::vector<Point>())
370    //
371
372    /**
373     * Performs object detection without a multi-scale window.
374     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
375     *     @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
376     *     @param weights Vector that will contain confidence values for each detected object.
377     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
378     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
379     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
380     *     @param winStride Window stride. It must be a multiple of block stride.
381     *     @param padding Padding
382     *     @param searchLocations Vector of Point includes set of requested locations to be evaluated.
383     */
384    public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride, Size padding, MatOfPoint searchLocations) {
385        Mat foundLocations_mat = foundLocations;
386        Mat weights_mat = weights;
387        Mat searchLocations_mat = searchLocations;
388        detect_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, searchLocations_mat.nativeObj);
389    }
390
391    /**
392     * Performs object detection without a multi-scale window.
393     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
394     *     @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
395     *     @param weights Vector that will contain confidence values for each detected object.
396     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
397     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
398     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
399     *     @param winStride Window stride. It must be a multiple of block stride.
400     *     @param padding Padding
401     */
402    public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride, Size padding) {
403        Mat foundLocations_mat = foundLocations;
404        Mat weights_mat = weights;
405        detect_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height);
406    }
407
408    /**
409     * Performs object detection without a multi-scale window.
410     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
411     *     @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
412     *     @param weights Vector that will contain confidence values for each detected object.
413     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
414     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
415     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
416     *     @param winStride Window stride. It must be a multiple of block stride.
417     */
418    public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride) {
419        Mat foundLocations_mat = foundLocations;
420        Mat weights_mat = weights;
421        detect_2(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height);
422    }
423
424    /**
425     * Performs object detection without a multi-scale window.
426     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
427     *     @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
428     *     @param weights Vector that will contain confidence values for each detected object.
429     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
430     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
431     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
432     */
433    public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold) {
434        Mat foundLocations_mat = foundLocations;
435        Mat weights_mat = weights;
436        detect_3(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold);
437    }
438
439    /**
440     * Performs object detection without a multi-scale window.
441     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
442     *     @param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
443     *     @param weights Vector that will contain confidence values for each detected object.
444     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
445     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
446     */
447    public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights) {
448        Mat foundLocations_mat = foundLocations;
449        Mat weights_mat = weights;
450        detect_4(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj);
451    }
452
453
454    //
455    // C++:  void cv::HOGDescriptor::detectMultiScale(Mat img, vector_Rect& foundLocations, vector_double& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, double groupThreshold = 2.0, bool useMeanshiftGrouping = false)
456    //
457
458    /**
459     * Detects objects of different sizes in the input image. The detected objects are returned as a list
460     *     of rectangles.
461     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
462     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
463     *     @param foundWeights Vector that will contain confidence values for each detected object.
464     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
465     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
466     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
467     *     @param winStride Window stride. It must be a multiple of block stride.
468     *     @param padding Padding
469     *     @param scale Coefficient of the detection window increase.
470     *     @param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered
471     *     by many rectangles. 0 means not to perform grouping.
472     *     @param useMeanshiftGrouping indicates grouping algorithm
473     */
474    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double groupThreshold, boolean useMeanshiftGrouping) {
475        Mat foundLocations_mat = foundLocations;
476        Mat foundWeights_mat = foundWeights;
477        detectMultiScale_0(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, groupThreshold, useMeanshiftGrouping);
478    }
479
480    /**
481     * Detects objects of different sizes in the input image. The detected objects are returned as a list
482     *     of rectangles.
483     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
484     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
485     *     @param foundWeights Vector that will contain confidence values for each detected object.
486     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
487     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
488     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
489     *     @param winStride Window stride. It must be a multiple of block stride.
490     *     @param padding Padding
491     *     @param scale Coefficient of the detection window increase.
492     *     @param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered
493     *     by many rectangles. 0 means not to perform grouping.
494     */
495    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double groupThreshold) {
496        Mat foundLocations_mat = foundLocations;
497        Mat foundWeights_mat = foundWeights;
498        detectMultiScale_1(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, groupThreshold);
499    }
500
501    /**
502     * Detects objects of different sizes in the input image. The detected objects are returned as a list
503     *     of rectangles.
504     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
505     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
506     *     @param foundWeights Vector that will contain confidence values for each detected object.
507     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
508     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
509     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
510     *     @param winStride Window stride. It must be a multiple of block stride.
511     *     @param padding Padding
512     *     @param scale Coefficient of the detection window increase.
513     *     by many rectangles. 0 means not to perform grouping.
514     */
515    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale) {
516        Mat foundLocations_mat = foundLocations;
517        Mat foundWeights_mat = foundWeights;
518        detectMultiScale_2(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale);
519    }
520
521    /**
522     * Detects objects of different sizes in the input image. The detected objects are returned as a list
523     *     of rectangles.
524     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
525     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
526     *     @param foundWeights Vector that will contain confidence values for each detected object.
527     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
528     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
529     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
530     *     @param winStride Window stride. It must be a multiple of block stride.
531     *     @param padding Padding
532     *     by many rectangles. 0 means not to perform grouping.
533     */
534    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding) {
535        Mat foundLocations_mat = foundLocations;
536        Mat foundWeights_mat = foundWeights;
537        detectMultiScale_3(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height);
538    }
539
540    /**
541     * Detects objects of different sizes in the input image. The detected objects are returned as a list
542     *     of rectangles.
543     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
544     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
545     *     @param foundWeights Vector that will contain confidence values for each detected object.
546     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
547     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
548     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
549     *     @param winStride Window stride. It must be a multiple of block stride.
550     *     by many rectangles. 0 means not to perform grouping.
551     */
552    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride) {
553        Mat foundLocations_mat = foundLocations;
554        Mat foundWeights_mat = foundWeights;
555        detectMultiScale_4(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height);
556    }
557
558    /**
559     * Detects objects of different sizes in the input image. The detected objects are returned as a list
560     *     of rectangles.
561     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
562     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
563     *     @param foundWeights Vector that will contain confidence values for each detected object.
564     *     @param hitThreshold Threshold for the distance between features and SVM classifying plane.
565     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
566     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
567     *     by many rectangles. 0 means not to perform grouping.
568     */
569    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold) {
570        Mat foundLocations_mat = foundLocations;
571        Mat foundWeights_mat = foundWeights;
572        detectMultiScale_5(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold);
573    }
574
575    /**
576     * Detects objects of different sizes in the input image. The detected objects are returned as a list
577     *     of rectangles.
578     *     @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
579     *     @param foundLocations Vector of rectangles where each rectangle contains the detected object.
580     *     @param foundWeights Vector that will contain confidence values for each detected object.
581     *     Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
582     *     But if the free coefficient is omitted (which is allowed), you can specify it manually here.
583     *     by many rectangles. 0 means not to perform grouping.
584     */
585    public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights) {
586        Mat foundLocations_mat = foundLocations;
587        Mat foundWeights_mat = foundWeights;
588        detectMultiScale_6(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);
589    }
590
591
592    //
593    // C++:  void cv::HOGDescriptor::computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
594    //
595
596    /**
597     *  Computes gradients and quantized gradient orientations.
598     *     @param img Matrix contains the image to be computed
599     *     @param grad Matrix of type CV_32FC2 contains computed gradients
600     *     @param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
601     *     @param paddingTL Padding from top-left
602     *     @param paddingBR Padding from bottom-right
603     */
604    public void computeGradient(Mat img, Mat grad, Mat angleOfs, Size paddingTL, Size paddingBR) {
605        computeGradient_0(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj, paddingTL.width, paddingTL.height, paddingBR.width, paddingBR.height);
606    }
607
608    /**
609     *  Computes gradients and quantized gradient orientations.
610     *     @param img Matrix contains the image to be computed
611     *     @param grad Matrix of type CV_32FC2 contains computed gradients
612     *     @param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
613     *     @param paddingTL Padding from top-left
614     */
615    public void computeGradient(Mat img, Mat grad, Mat angleOfs, Size paddingTL) {
616        computeGradient_1(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj, paddingTL.width, paddingTL.height);
617    }
618
619    /**
620     *  Computes gradients and quantized gradient orientations.
621     *     @param img Matrix contains the image to be computed
622     *     @param grad Matrix of type CV_32FC2 contains computed gradients
623     *     @param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
624     */
625    public void computeGradient(Mat img, Mat grad, Mat angleOfs) {
626        computeGradient_2(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj);
627    }
628
629
630    //
631    // C++: static vector_float cv::HOGDescriptor::getDefaultPeopleDetector()
632    //
633
634    /**
635     * Returns coefficients of the classifier trained for people detection (for 64x128 windows).
636     * @return automatically generated
637     */
638    public static MatOfFloat getDefaultPeopleDetector() {
639        return MatOfFloat.fromNativeAddr(getDefaultPeopleDetector_0());
640    }
641
642
643    //
644    // C++: static vector_float cv::HOGDescriptor::getDaimlerPeopleDetector()
645    //
646
647    /**
648     * Returns coefficients of the classifier trained for people detection (for 48x96 windows).
649     * @return automatically generated
650     */
651    public static MatOfFloat getDaimlerPeopleDetector() {
652        return MatOfFloat.fromNativeAddr(getDaimlerPeopleDetector_0());
653    }
654
655
656    //
657    // C++: Size HOGDescriptor::winSize
658    //
659
660    public Size get_winSize() {
661        return new Size(get_winSize_0(nativeObj));
662    }
663
664
665    //
666    // C++: Size HOGDescriptor::blockSize
667    //
668
669    public Size get_blockSize() {
670        return new Size(get_blockSize_0(nativeObj));
671    }
672
673
674    //
675    // C++: Size HOGDescriptor::blockStride
676    //
677
678    public Size get_blockStride() {
679        return new Size(get_blockStride_0(nativeObj));
680    }
681
682
683    //
684    // C++: Size HOGDescriptor::cellSize
685    //
686
687    public Size get_cellSize() {
688        return new Size(get_cellSize_0(nativeObj));
689    }
690
691
692    //
693    // C++: int HOGDescriptor::nbins
694    //
695
696    public int get_nbins() {
697        return get_nbins_0(nativeObj);
698    }
699
700
701    //
702    // C++: int HOGDescriptor::derivAperture
703    //
704
705    public int get_derivAperture() {
706        return get_derivAperture_0(nativeObj);
707    }
708
709
710    //
711    // C++: double HOGDescriptor::winSigma
712    //
713
714    public double get_winSigma() {
715        return get_winSigma_0(nativeObj);
716    }
717
718
719    //
720    // C++: HOGDescriptor_HistogramNormType HOGDescriptor::histogramNormType
721    //
722
723    public int get_histogramNormType() {
724        return get_histogramNormType_0(nativeObj);
725    }
726
727
728    //
729    // C++: double HOGDescriptor::L2HysThreshold
730    //
731
732    public double get_L2HysThreshold() {
733        return get_L2HysThreshold_0(nativeObj);
734    }
735
736
737    //
738    // C++: bool HOGDescriptor::gammaCorrection
739    //
740
741    public boolean get_gammaCorrection() {
742        return get_gammaCorrection_0(nativeObj);
743    }
744
745
746    //
747    // C++: vector_float HOGDescriptor::svmDetector
748    //
749
750    public MatOfFloat get_svmDetector() {
751        return MatOfFloat.fromNativeAddr(get_svmDetector_0(nativeObj));
752    }
753
754
755    //
756    // C++: int HOGDescriptor::nlevels
757    //
758
759    public int get_nlevels() {
760        return get_nlevels_0(nativeObj);
761    }
762
763
764    //
765    // C++: bool HOGDescriptor::signedGradient
766    //
767
768    public boolean get_signedGradient() {
769        return get_signedGradient_0(nativeObj);
770    }
771
772
773    @Override
774    protected void finalize() throws Throwable {
775        delete(nativeObj);
776    }
777
778
779
780    // C++:   cv::HOGDescriptor::HOGDescriptor()
781    private static native long HOGDescriptor_0();
782
783    // C++:   cv::HOGDescriptor::HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture = 1, double _winSigma = -1, HOGDescriptor_HistogramNormType _histogramNormType = HOGDescriptor::L2Hys, double _L2HysThreshold = 0.2, bool _gammaCorrection = false, int _nlevels = HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient = false)
784    private static native long HOGDescriptor_1(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels, boolean _signedGradient);
785    private static native long HOGDescriptor_2(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection, int _nlevels);
786    private static native long HOGDescriptor_3(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, boolean _gammaCorrection);
787    private static native long HOGDescriptor_4(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold);
788    private static native long HOGDescriptor_5(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType);
789    private static native long HOGDescriptor_6(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture, double _winSigma);
790    private static native long HOGDescriptor_7(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins, int _derivAperture);
791    private static native long HOGDescriptor_8(double _winSize_width, double _winSize_height, double _blockSize_width, double _blockSize_height, double _blockStride_width, double _blockStride_height, double _cellSize_width, double _cellSize_height, int _nbins);
792
793    // C++:   cv::HOGDescriptor::HOGDescriptor(String filename)
794    private static native long HOGDescriptor_9(String filename);
795
796    // C++:  size_t cv::HOGDescriptor::getDescriptorSize()
797    private static native long getDescriptorSize_0(long nativeObj);
798
799    // C++:  bool cv::HOGDescriptor::checkDetectorSize()
800    private static native boolean checkDetectorSize_0(long nativeObj);
801
802    // C++:  double cv::HOGDescriptor::getWinSigma()
803    private static native double getWinSigma_0(long nativeObj);
804
805    // C++:  void cv::HOGDescriptor::setSVMDetector(Mat svmdetector)
806    private static native void setSVMDetector_0(long nativeObj, long svmdetector_nativeObj);
807
808    // C++:  bool cv::HOGDescriptor::load(String filename, String objname = String())
809    private static native boolean load_0(long nativeObj, String filename, String objname);
810    private static native boolean load_1(long nativeObj, String filename);
811
812    // C++:  void cv::HOGDescriptor::save(String filename, String objname = String())
813    private static native void save_0(long nativeObj, String filename, String objname);
814    private static native void save_1(long nativeObj, String filename);
815
816    // C++:  void cv::HOGDescriptor::compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
817    private static native void compute_0(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj, double winStride_width, double winStride_height, double padding_width, double padding_height, long locations_mat_nativeObj);
818    private static native void compute_1(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj, double winStride_width, double winStride_height, double padding_width, double padding_height);
819    private static native void compute_2(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj, double winStride_width, double winStride_height);
820    private static native void compute_3(long nativeObj, long img_nativeObj, long descriptors_mat_nativeObj);
821
822    // C++:  void cv::HOGDescriptor::detect(Mat img, vector_Point& foundLocations, vector_double& weights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), vector_Point searchLocations = std::vector<Point>())
823    private static native void detect_0(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, long searchLocations_mat_nativeObj);
824    private static native void detect_1(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height);
825    private static native void detect_2(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height);
826    private static native void detect_3(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj, double hitThreshold);
827    private static native void detect_4(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long weights_mat_nativeObj);
828
829    // C++:  void cv::HOGDescriptor::detectMultiScale(Mat img, vector_Rect& foundLocations, vector_double& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, double groupThreshold = 2.0, bool useMeanshiftGrouping = false)
830    private static native void detectMultiScale_0(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale, double groupThreshold, boolean useMeanshiftGrouping);
831    private static native void detectMultiScale_1(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale, double groupThreshold);
832    private static native void detectMultiScale_2(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale);
833    private static native void detectMultiScale_3(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height);
834    private static native void detectMultiScale_4(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height);
835    private static native void detectMultiScale_5(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj, double hitThreshold);
836    private static native void detectMultiScale_6(long nativeObj, long img_nativeObj, long foundLocations_mat_nativeObj, long foundWeights_mat_nativeObj);
837
838    // C++:  void cv::HOGDescriptor::computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
839    private static native void computeGradient_0(long nativeObj, long img_nativeObj, long grad_nativeObj, long angleOfs_nativeObj, double paddingTL_width, double paddingTL_height, double paddingBR_width, double paddingBR_height);
840    private static native void computeGradient_1(long nativeObj, long img_nativeObj, long grad_nativeObj, long angleOfs_nativeObj, double paddingTL_width, double paddingTL_height);
841    private static native void computeGradient_2(long nativeObj, long img_nativeObj, long grad_nativeObj, long angleOfs_nativeObj);
842
843    // C++: static vector_float cv::HOGDescriptor::getDefaultPeopleDetector()
844    private static native long getDefaultPeopleDetector_0();
845
846    // C++: static vector_float cv::HOGDescriptor::getDaimlerPeopleDetector()
847    private static native long getDaimlerPeopleDetector_0();
848
849    // C++: Size HOGDescriptor::winSize
850    private static native double[] get_winSize_0(long nativeObj);
851
852    // C++: Size HOGDescriptor::blockSize
853    private static native double[] get_blockSize_0(long nativeObj);
854
855    // C++: Size HOGDescriptor::blockStride
856    private static native double[] get_blockStride_0(long nativeObj);
857
858    // C++: Size HOGDescriptor::cellSize
859    private static native double[] get_cellSize_0(long nativeObj);
860
861    // C++: int HOGDescriptor::nbins
862    private static native int get_nbins_0(long nativeObj);
863
864    // C++: int HOGDescriptor::derivAperture
865    private static native int get_derivAperture_0(long nativeObj);
866
867    // C++: double HOGDescriptor::winSigma
868    private static native double get_winSigma_0(long nativeObj);
869
870    // C++: HOGDescriptor_HistogramNormType HOGDescriptor::histogramNormType
871    private static native int get_histogramNormType_0(long nativeObj);
872
873    // C++: double HOGDescriptor::L2HysThreshold
874    private static native double get_L2HysThreshold_0(long nativeObj);
875
876    // C++: bool HOGDescriptor::gammaCorrection
877    private static native boolean get_gammaCorrection_0(long nativeObj);
878
879    // C++: vector_float HOGDescriptor::svmDetector
880    private static native long get_svmDetector_0(long nativeObj);
881
882    // C++: int HOGDescriptor::nlevels
883    private static native int get_nlevels_0(long nativeObj);
884
885    // C++: bool HOGDescriptor::signedGradient
886    private static native boolean get_signedGradient_0(long nativeObj);
887
888    // native support for java finalize()
889    private static native void delete(long nativeObj);
890
891}