HOGDescriptor.cs 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.ObjdetectModule
  7. {
  8. // C++: class HOGDescriptor
  9. /**
  10. * Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.
  11. *
  12. * the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs CITE: Dalal2005 .
  13. *
  14. * useful links:
  15. *
  16. * https://hal.inria.fr/inria-00548512/document/
  17. *
  18. * https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
  19. *
  20. * https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor
  21. *
  22. * http://www.learnopencv.com/histogram-of-oriented-gradients
  23. *
  24. * http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial
  25. */
  26. public class HOGDescriptor : DisposableOpenCVObject
  27. {
  28. protected override void Dispose(bool disposing)
  29. {
  30. try
  31. {
  32. if (disposing)
  33. {
  34. }
  35. if (IsEnabledDispose)
  36. {
  37. if (nativeObj != IntPtr.Zero)
  38. objdetect_HOGDescriptor_delete(nativeObj);
  39. nativeObj = IntPtr.Zero;
  40. }
  41. }
  42. finally
  43. {
  44. base.Dispose(disposing);
  45. }
  46. }
  47. protected internal HOGDescriptor(IntPtr addr) : base(addr) { }
  48. public IntPtr getNativeObjAddr() { return nativeObj; }
  49. // internal usage only
  50. public static HOGDescriptor __fromPtr__(IntPtr addr) { return new HOGDescriptor(addr); }
  51. // C++: enum <unnamed>
  52. public const int DEFAULT_NLEVELS = 64;
  53. // C++: enum cv.HOGDescriptor.DescriptorStorageFormat
  54. public const int DESCR_FORMAT_COL_BY_COL = 0;
  55. public const int DESCR_FORMAT_ROW_BY_ROW = 1;
  56. // C++: enum cv.HOGDescriptor.HistogramNormType
  57. public const int L2Hys = 0;
  58. //
  59. // C++: cv::HOGDescriptor::HOGDescriptor()
  60. //
  61. /**
  62. * Creates the HOG descriptor and detector with default parameters.
  63. *
  64. * aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
  65. */
  66. public HOGDescriptor()
  67. {
  68. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_10());
  69. }
  70. //
  71. // 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)
  72. //
  73. /**
  74. *
  75. * param _winSize sets winSize with given value.
  76. * param _blockSize sets blockSize with given value.
  77. * param _blockStride sets blockStride with given value.
  78. * param _cellSize sets cellSize with given value.
  79. * param _nbins sets nbins with given value.
  80. * param _derivAperture sets derivAperture with given value.
  81. * param _winSigma sets winSigma with given value.
  82. * param _histogramNormType sets histogramNormType with given value.
  83. * param _L2HysThreshold sets L2HysThreshold with given value.
  84. * param _gammaCorrection sets gammaCorrection with given value.
  85. * param _nlevels sets nlevels with given value.
  86. * param _signedGradient sets signedGradient with given value.
  87. */
  88. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, bool _gammaCorrection, int _nlevels, bool _signedGradient)
  89. {
  90. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_11(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels, _signedGradient));
  91. }
  92. /**
  93. *
  94. * param _winSize sets winSize with given value.
  95. * param _blockSize sets blockSize with given value.
  96. * param _blockStride sets blockStride with given value.
  97. * param _cellSize sets cellSize with given value.
  98. * param _nbins sets nbins with given value.
  99. * param _derivAperture sets derivAperture with given value.
  100. * param _winSigma sets winSigma with given value.
  101. * param _histogramNormType sets histogramNormType with given value.
  102. * param _L2HysThreshold sets L2HysThreshold with given value.
  103. * param _gammaCorrection sets gammaCorrection with given value.
  104. * param _nlevels sets nlevels with given value.
  105. */
  106. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, bool _gammaCorrection, int _nlevels)
  107. {
  108. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_12(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection, _nlevels));
  109. }
  110. /**
  111. *
  112. * param _winSize sets winSize with given value.
  113. * param _blockSize sets blockSize with given value.
  114. * param _blockStride sets blockStride with given value.
  115. * param _cellSize sets cellSize with given value.
  116. * param _nbins sets nbins with given value.
  117. * param _derivAperture sets derivAperture with given value.
  118. * param _winSigma sets winSigma with given value.
  119. * param _histogramNormType sets histogramNormType with given value.
  120. * param _L2HysThreshold sets L2HysThreshold with given value.
  121. * param _gammaCorrection sets gammaCorrection with given value.
  122. */
  123. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold, bool _gammaCorrection)
  124. {
  125. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_13(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold, _gammaCorrection));
  126. }
  127. /**
  128. *
  129. * param _winSize sets winSize with given value.
  130. * param _blockSize sets blockSize with given value.
  131. * param _blockStride sets blockStride with given value.
  132. * param _cellSize sets cellSize with given value.
  133. * param _nbins sets nbins with given value.
  134. * param _derivAperture sets derivAperture with given value.
  135. * param _winSigma sets winSigma with given value.
  136. * param _histogramNormType sets histogramNormType with given value.
  137. * param _L2HysThreshold sets L2HysThreshold with given value.
  138. */
  139. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType, double _L2HysThreshold)
  140. {
  141. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_14(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType, _L2HysThreshold));
  142. }
  143. /**
  144. *
  145. * param _winSize sets winSize with given value.
  146. * param _blockSize sets blockSize with given value.
  147. * param _blockStride sets blockStride with given value.
  148. * param _cellSize sets cellSize with given value.
  149. * param _nbins sets nbins with given value.
  150. * param _derivAperture sets derivAperture with given value.
  151. * param _winSigma sets winSigma with given value.
  152. * param _histogramNormType sets histogramNormType with given value.
  153. */
  154. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma, int _histogramNormType)
  155. {
  156. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_15(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma, _histogramNormType));
  157. }
  158. /**
  159. *
  160. * param _winSize sets winSize with given value.
  161. * param _blockSize sets blockSize with given value.
  162. * param _blockStride sets blockStride with given value.
  163. * param _cellSize sets cellSize with given value.
  164. * param _nbins sets nbins with given value.
  165. * param _derivAperture sets derivAperture with given value.
  166. * param _winSigma sets winSigma with given value.
  167. */
  168. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture, double _winSigma)
  169. {
  170. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_16(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture, _winSigma));
  171. }
  172. /**
  173. *
  174. * param _winSize sets winSize with given value.
  175. * param _blockSize sets blockSize with given value.
  176. * param _blockStride sets blockStride with given value.
  177. * param _cellSize sets cellSize with given value.
  178. * param _nbins sets nbins with given value.
  179. * param _derivAperture sets derivAperture with given value.
  180. */
  181. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture)
  182. {
  183. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_17(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins, _derivAperture));
  184. }
  185. /**
  186. *
  187. * param _winSize sets winSize with given value.
  188. * param _blockSize sets blockSize with given value.
  189. * param _blockStride sets blockStride with given value.
  190. * param _cellSize sets cellSize with given value.
  191. * param _nbins sets nbins with given value.
  192. */
  193. public HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins)
  194. {
  195. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_18(_winSize.width, _winSize.height, _blockSize.width, _blockSize.height, _blockStride.width, _blockStride.height, _cellSize.width, _cellSize.height, _nbins));
  196. }
  197. //
  198. // C++: cv::HOGDescriptor::HOGDescriptor(String filename)
  199. //
  200. /**
  201. *
  202. *
  203. * Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.
  204. * param filename The file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.
  205. */
  206. public HOGDescriptor(string filename)
  207. {
  208. nativeObj = DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_HOGDescriptor_19(filename));
  209. }
  210. //
  211. // C++: size_t cv::HOGDescriptor::getDescriptorSize()
  212. //
  213. /**
  214. * Returns the number of coefficients required for the classification.
  215. * return automatically generated
  216. */
  217. public long getDescriptorSize()
  218. {
  219. ThrowIfDisposed();
  220. return objdetect_HOGDescriptor_getDescriptorSize_10(nativeObj);
  221. }
  222. //
  223. // C++: bool cv::HOGDescriptor::checkDetectorSize()
  224. //
  225. /**
  226. * Checks if detector size equal to descriptor size.
  227. * return automatically generated
  228. */
  229. public bool checkDetectorSize()
  230. {
  231. ThrowIfDisposed();
  232. return objdetect_HOGDescriptor_checkDetectorSize_10(nativeObj);
  233. }
  234. //
  235. // C++: double cv::HOGDescriptor::getWinSigma()
  236. //
  237. /**
  238. * Returns winSigma value
  239. * return automatically generated
  240. */
  241. public double getWinSigma()
  242. {
  243. ThrowIfDisposed();
  244. return objdetect_HOGDescriptor_getWinSigma_10(nativeObj);
  245. }
  246. //
  247. // C++: void cv::HOGDescriptor::setSVMDetector(Mat svmdetector)
  248. //
  249. /**
  250. * Sets coefficients for the linear SVM classifier.
  251. * param svmdetector coefficients for the linear SVM classifier.
  252. */
  253. public void setSVMDetector(Mat svmdetector)
  254. {
  255. ThrowIfDisposed();
  256. if (svmdetector != null) svmdetector.ThrowIfDisposed();
  257. objdetect_HOGDescriptor_setSVMDetector_10(nativeObj, svmdetector.nativeObj);
  258. }
  259. //
  260. // C++: bool cv::HOGDescriptor::load(String filename, String objname = String())
  261. //
  262. /**
  263. * loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file
  264. * param filename Name of the file to read.
  265. * param objname The optional name of the node to read (if empty, the first top-level node will be used).
  266. * return automatically generated
  267. */
  268. public bool load(string filename, string objname)
  269. {
  270. ThrowIfDisposed();
  271. return objdetect_HOGDescriptor_load_10(nativeObj, filename, objname);
  272. }
  273. /**
  274. * loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file
  275. * param filename Name of the file to read.
  276. * return automatically generated
  277. */
  278. public bool load(string filename)
  279. {
  280. ThrowIfDisposed();
  281. return objdetect_HOGDescriptor_load_11(nativeObj, filename);
  282. }
  283. //
  284. // C++: void cv::HOGDescriptor::save(String filename, String objname = String())
  285. //
  286. /**
  287. * saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file
  288. * param filename File name
  289. * param objname Object name
  290. */
  291. public void save(string filename, string objname)
  292. {
  293. ThrowIfDisposed();
  294. objdetect_HOGDescriptor_save_10(nativeObj, filename, objname);
  295. }
  296. /**
  297. * saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file
  298. * param filename File name
  299. */
  300. public void save(string filename)
  301. {
  302. ThrowIfDisposed();
  303. objdetect_HOGDescriptor_save_11(nativeObj, filename);
  304. }
  305. //
  306. // C++: void cv::HOGDescriptor::compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
  307. //
  308. /**
  309. * Computes HOG descriptors of given image.
  310. * param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
  311. * param descriptors Matrix of the type CV_32F
  312. * param winStride Window stride. It must be a multiple of block stride.
  313. * param padding Padding
  314. * param locations Vector of Point
  315. */
  316. public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding, MatOfPoint locations)
  317. {
  318. ThrowIfDisposed();
  319. if (img != null) img.ThrowIfDisposed();
  320. if (descriptors != null) descriptors.ThrowIfDisposed();
  321. if (locations != null) locations.ThrowIfDisposed();
  322. Mat descriptors_mat = descriptors;
  323. Mat locations_mat = locations;
  324. objdetect_HOGDescriptor_compute_10(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height, padding.width, padding.height, locations_mat.nativeObj);
  325. }
  326. /**
  327. * Computes HOG descriptors of given image.
  328. * param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
  329. * param descriptors Matrix of the type CV_32F
  330. * param winStride Window stride. It must be a multiple of block stride.
  331. * param padding Padding
  332. */
  333. public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding)
  334. {
  335. ThrowIfDisposed();
  336. if (img != null) img.ThrowIfDisposed();
  337. if (descriptors != null) descriptors.ThrowIfDisposed();
  338. Mat descriptors_mat = descriptors;
  339. objdetect_HOGDescriptor_compute_11(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height, padding.width, padding.height);
  340. }
  341. /**
  342. * Computes HOG descriptors of given image.
  343. * param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
  344. * param descriptors Matrix of the type CV_32F
  345. * param winStride Window stride. It must be a multiple of block stride.
  346. */
  347. public void compute(Mat img, MatOfFloat descriptors, Size winStride)
  348. {
  349. ThrowIfDisposed();
  350. if (img != null) img.ThrowIfDisposed();
  351. if (descriptors != null) descriptors.ThrowIfDisposed();
  352. Mat descriptors_mat = descriptors;
  353. objdetect_HOGDescriptor_compute_12(nativeObj, img.nativeObj, descriptors_mat.nativeObj, winStride.width, winStride.height);
  354. }
  355. /**
  356. * Computes HOG descriptors of given image.
  357. * param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
  358. * param descriptors Matrix of the type CV_32F
  359. */
  360. public void compute(Mat img, MatOfFloat descriptors)
  361. {
  362. ThrowIfDisposed();
  363. if (img != null) img.ThrowIfDisposed();
  364. if (descriptors != null) descriptors.ThrowIfDisposed();
  365. Mat descriptors_mat = descriptors;
  366. objdetect_HOGDescriptor_compute_13(nativeObj, img.nativeObj, descriptors_mat.nativeObj);
  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. * Performs object detection without a multi-scale window.
  373. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  374. * param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
  375. * param weights Vector that will contain confidence values for each detected object.
  376. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  377. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  378. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  379. * param winStride Window stride. It must be a multiple of block stride.
  380. * param padding Padding
  381. * param searchLocations Vector of Point includes set of requested locations to be evaluated.
  382. */
  383. public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride, Size padding, MatOfPoint searchLocations)
  384. {
  385. ThrowIfDisposed();
  386. if (img != null) img.ThrowIfDisposed();
  387. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  388. if (weights != null) weights.ThrowIfDisposed();
  389. if (searchLocations != null) searchLocations.ThrowIfDisposed();
  390. Mat foundLocations_mat = foundLocations;
  391. Mat weights_mat = weights;
  392. Mat searchLocations_mat = searchLocations;
  393. objdetect_HOGDescriptor_detect_10(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, searchLocations_mat.nativeObj);
  394. }
  395. /**
  396. * Performs object detection without a multi-scale window.
  397. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  398. * param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
  399. * param weights Vector that will contain confidence values for each detected object.
  400. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  401. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  402. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  403. * param winStride Window stride. It must be a multiple of block stride.
  404. * param padding Padding
  405. */
  406. public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride, Size padding)
  407. {
  408. ThrowIfDisposed();
  409. if (img != null) img.ThrowIfDisposed();
  410. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  411. if (weights != null) weights.ThrowIfDisposed();
  412. Mat foundLocations_mat = foundLocations;
  413. Mat weights_mat = weights;
  414. objdetect_HOGDescriptor_detect_11(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height);
  415. }
  416. /**
  417. * Performs object detection without a multi-scale window.
  418. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  419. * param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
  420. * param weights Vector that will contain confidence values for each detected object.
  421. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  422. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  423. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  424. * param winStride Window stride. It must be a multiple of block stride.
  425. */
  426. public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold, Size winStride)
  427. {
  428. ThrowIfDisposed();
  429. if (img != null) img.ThrowIfDisposed();
  430. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  431. if (weights != null) weights.ThrowIfDisposed();
  432. Mat foundLocations_mat = foundLocations;
  433. Mat weights_mat = weights;
  434. objdetect_HOGDescriptor_detect_12(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold, winStride.width, winStride.height);
  435. }
  436. /**
  437. * Performs object detection without a multi-scale window.
  438. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  439. * param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
  440. * param weights Vector that will contain confidence values for each detected object.
  441. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  442. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  443. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  444. */
  445. public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights, double hitThreshold)
  446. {
  447. ThrowIfDisposed();
  448. if (img != null) img.ThrowIfDisposed();
  449. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  450. if (weights != null) weights.ThrowIfDisposed();
  451. Mat foundLocations_mat = foundLocations;
  452. Mat weights_mat = weights;
  453. objdetect_HOGDescriptor_detect_13(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj, hitThreshold);
  454. }
  455. /**
  456. * Performs object detection without a multi-scale window.
  457. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  458. * param foundLocations Vector of point where each point contains left-top corner point of detected object boundaries.
  459. * param weights Vector that will contain confidence values for each detected object.
  460. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  461. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  462. */
  463. public void detect(Mat img, MatOfPoint foundLocations, MatOfDouble weights)
  464. {
  465. ThrowIfDisposed();
  466. if (img != null) img.ThrowIfDisposed();
  467. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  468. if (weights != null) weights.ThrowIfDisposed();
  469. Mat foundLocations_mat = foundLocations;
  470. Mat weights_mat = weights;
  471. objdetect_HOGDescriptor_detect_14(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, weights_mat.nativeObj);
  472. }
  473. //
  474. // 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)
  475. //
  476. /**
  477. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  478. * of rectangles.
  479. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  480. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  481. * param foundWeights Vector that will contain confidence values for each detected object.
  482. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  483. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  484. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  485. * param winStride Window stride. It must be a multiple of block stride.
  486. * param padding Padding
  487. * param scale Coefficient of the detection window increase.
  488. * param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered
  489. * by many rectangles. 0 means not to perform grouping.
  490. * param useMeanshiftGrouping indicates grouping algorithm
  491. */
  492. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double groupThreshold, bool useMeanshiftGrouping)
  493. {
  494. ThrowIfDisposed();
  495. if (img != null) img.ThrowIfDisposed();
  496. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  497. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  498. Mat foundLocations_mat = foundLocations;
  499. Mat foundWeights_mat = foundWeights;
  500. objdetect_HOGDescriptor_detectMultiScale_10(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, groupThreshold, useMeanshiftGrouping);
  501. }
  502. /**
  503. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  504. * of rectangles.
  505. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  506. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  507. * param foundWeights Vector that will contain confidence values for each detected object.
  508. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  509. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  510. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  511. * param winStride Window stride. It must be a multiple of block stride.
  512. * param padding Padding
  513. * param scale Coefficient of the detection window increase.
  514. * param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered
  515. * by many rectangles. 0 means not to perform grouping.
  516. */
  517. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale, double groupThreshold)
  518. {
  519. ThrowIfDisposed();
  520. if (img != null) img.ThrowIfDisposed();
  521. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  522. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  523. Mat foundLocations_mat = foundLocations;
  524. Mat foundWeights_mat = foundWeights;
  525. objdetect_HOGDescriptor_detectMultiScale_11(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale, groupThreshold);
  526. }
  527. /**
  528. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  529. * of rectangles.
  530. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  531. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  532. * param foundWeights Vector that will contain confidence values for each detected object.
  533. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  534. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  535. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  536. * param winStride Window stride. It must be a multiple of block stride.
  537. * param padding Padding
  538. * param scale Coefficient of the detection window increase.
  539. * by many rectangles. 0 means not to perform grouping.
  540. */
  541. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding, double scale)
  542. {
  543. ThrowIfDisposed();
  544. if (img != null) img.ThrowIfDisposed();
  545. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  546. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  547. Mat foundLocations_mat = foundLocations;
  548. Mat foundWeights_mat = foundWeights;
  549. objdetect_HOGDescriptor_detectMultiScale_12(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height, scale);
  550. }
  551. /**
  552. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  553. * of rectangles.
  554. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  555. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  556. * param foundWeights Vector that will contain confidence values for each detected object.
  557. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  558. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  559. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  560. * param winStride Window stride. It must be a multiple of block stride.
  561. * param padding Padding
  562. * by many rectangles. 0 means not to perform grouping.
  563. */
  564. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride, Size padding)
  565. {
  566. ThrowIfDisposed();
  567. if (img != null) img.ThrowIfDisposed();
  568. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  569. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  570. Mat foundLocations_mat = foundLocations;
  571. Mat foundWeights_mat = foundWeights;
  572. objdetect_HOGDescriptor_detectMultiScale_13(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height, padding.width, padding.height);
  573. }
  574. /**
  575. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  576. * of rectangles.
  577. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  578. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  579. * param foundWeights Vector that will contain confidence values for each detected object.
  580. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  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. * param winStride Window stride. It must be a multiple of block stride.
  584. * by many rectangles. 0 means not to perform grouping.
  585. */
  586. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold, Size winStride)
  587. {
  588. ThrowIfDisposed();
  589. if (img != null) img.ThrowIfDisposed();
  590. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  591. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  592. Mat foundLocations_mat = foundLocations;
  593. Mat foundWeights_mat = foundWeights;
  594. objdetect_HOGDescriptor_detectMultiScale_14(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold, winStride.width, winStride.height);
  595. }
  596. /**
  597. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  598. * of rectangles.
  599. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  600. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  601. * param foundWeights Vector that will contain confidence values for each detected object.
  602. * param hitThreshold Threshold for the distance between features and SVM classifying plane.
  603. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  604. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  605. * by many rectangles. 0 means not to perform grouping.
  606. */
  607. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights, double hitThreshold)
  608. {
  609. ThrowIfDisposed();
  610. if (img != null) img.ThrowIfDisposed();
  611. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  612. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  613. Mat foundLocations_mat = foundLocations;
  614. Mat foundWeights_mat = foundWeights;
  615. objdetect_HOGDescriptor_detectMultiScale_15(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj, hitThreshold);
  616. }
  617. /**
  618. * Detects objects of different sizes in the input image. The detected objects are returned as a list
  619. * of rectangles.
  620. * param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
  621. * param foundLocations Vector of rectangles where each rectangle contains the detected object.
  622. * param foundWeights Vector that will contain confidence values for each detected object.
  623. * Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient).
  624. * But if the free coefficient is omitted (which is allowed), you can specify it manually here.
  625. * by many rectangles. 0 means not to perform grouping.
  626. */
  627. public void detectMultiScale(Mat img, MatOfRect foundLocations, MatOfDouble foundWeights)
  628. {
  629. ThrowIfDisposed();
  630. if (img != null) img.ThrowIfDisposed();
  631. if (foundLocations != null) foundLocations.ThrowIfDisposed();
  632. if (foundWeights != null) foundWeights.ThrowIfDisposed();
  633. Mat foundLocations_mat = foundLocations;
  634. Mat foundWeights_mat = foundWeights;
  635. objdetect_HOGDescriptor_detectMultiScale_16(nativeObj, img.nativeObj, foundLocations_mat.nativeObj, foundWeights_mat.nativeObj);
  636. }
  637. //
  638. // C++: void cv::HOGDescriptor::computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
  639. //
  640. /**
  641. * Computes gradients and quantized gradient orientations.
  642. * param img Matrix contains the image to be computed
  643. * param grad Matrix of type CV_32FC2 contains computed gradients
  644. * param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
  645. * param paddingTL Padding from top-left
  646. * param paddingBR Padding from bottom-right
  647. */
  648. public void computeGradient(Mat img, Mat grad, Mat angleOfs, Size paddingTL, Size paddingBR)
  649. {
  650. ThrowIfDisposed();
  651. if (img != null) img.ThrowIfDisposed();
  652. if (grad != null) grad.ThrowIfDisposed();
  653. if (angleOfs != null) angleOfs.ThrowIfDisposed();
  654. objdetect_HOGDescriptor_computeGradient_10(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj, paddingTL.width, paddingTL.height, paddingBR.width, paddingBR.height);
  655. }
  656. /**
  657. * Computes gradients and quantized gradient orientations.
  658. * param img Matrix contains the image to be computed
  659. * param grad Matrix of type CV_32FC2 contains computed gradients
  660. * param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
  661. * param paddingTL Padding from top-left
  662. */
  663. public void computeGradient(Mat img, Mat grad, Mat angleOfs, Size paddingTL)
  664. {
  665. ThrowIfDisposed();
  666. if (img != null) img.ThrowIfDisposed();
  667. if (grad != null) grad.ThrowIfDisposed();
  668. if (angleOfs != null) angleOfs.ThrowIfDisposed();
  669. objdetect_HOGDescriptor_computeGradient_11(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj, paddingTL.width, paddingTL.height);
  670. }
  671. /**
  672. * Computes gradients and quantized gradient orientations.
  673. * param img Matrix contains the image to be computed
  674. * param grad Matrix of type CV_32FC2 contains computed gradients
  675. * param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
  676. */
  677. public void computeGradient(Mat img, Mat grad, Mat angleOfs)
  678. {
  679. ThrowIfDisposed();
  680. if (img != null) img.ThrowIfDisposed();
  681. if (grad != null) grad.ThrowIfDisposed();
  682. if (angleOfs != null) angleOfs.ThrowIfDisposed();
  683. objdetect_HOGDescriptor_computeGradient_12(nativeObj, img.nativeObj, grad.nativeObj, angleOfs.nativeObj);
  684. }
  685. //
  686. // C++: static vector_float cv::HOGDescriptor::getDefaultPeopleDetector()
  687. //
  688. /**
  689. * Returns coefficients of the classifier trained for people detection (for 64x128 windows).
  690. * return automatically generated
  691. */
  692. public static MatOfFloat getDefaultPeopleDetector()
  693. {
  694. return MatOfFloat.fromNativeAddr(DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_getDefaultPeopleDetector_10()));
  695. }
  696. //
  697. // C++: static vector_float cv::HOGDescriptor::getDaimlerPeopleDetector()
  698. //
  699. /**
  700. * Returns coefficients of the classifier trained for people detection (for 48x96 windows).
  701. * return automatically generated
  702. */
  703. public static MatOfFloat getDaimlerPeopleDetector()
  704. {
  705. return MatOfFloat.fromNativeAddr(DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_getDaimlerPeopleDetector_10()));
  706. }
  707. //
  708. // C++: Size HOGDescriptor::winSize
  709. //
  710. public Size get_winSize()
  711. {
  712. ThrowIfDisposed();
  713. double[] tmpArray = new double[2];
  714. objdetect_HOGDescriptor_get_1winSize_10(nativeObj, tmpArray);
  715. Size retVal = new Size(tmpArray);
  716. return retVal;
  717. }
  718. //
  719. // C++: Size HOGDescriptor::blockSize
  720. //
  721. public Size get_blockSize()
  722. {
  723. ThrowIfDisposed();
  724. double[] tmpArray = new double[2];
  725. objdetect_HOGDescriptor_get_1blockSize_10(nativeObj, tmpArray);
  726. Size retVal = new Size(tmpArray);
  727. return retVal;
  728. }
  729. //
  730. // C++: Size HOGDescriptor::blockStride
  731. //
  732. public Size get_blockStride()
  733. {
  734. ThrowIfDisposed();
  735. double[] tmpArray = new double[2];
  736. objdetect_HOGDescriptor_get_1blockStride_10(nativeObj, tmpArray);
  737. Size retVal = new Size(tmpArray);
  738. return retVal;
  739. }
  740. //
  741. // C++: Size HOGDescriptor::cellSize
  742. //
  743. public Size get_cellSize()
  744. {
  745. ThrowIfDisposed();
  746. double[] tmpArray = new double[2];
  747. objdetect_HOGDescriptor_get_1cellSize_10(nativeObj, tmpArray);
  748. Size retVal = new Size(tmpArray);
  749. return retVal;
  750. }
  751. //
  752. // C++: int HOGDescriptor::nbins
  753. //
  754. public int get_nbins()
  755. {
  756. ThrowIfDisposed();
  757. return objdetect_HOGDescriptor_get_1nbins_10(nativeObj);
  758. }
  759. //
  760. // C++: int HOGDescriptor::derivAperture
  761. //
  762. public int get_derivAperture()
  763. {
  764. ThrowIfDisposed();
  765. return objdetect_HOGDescriptor_get_1derivAperture_10(nativeObj);
  766. }
  767. //
  768. // C++: double HOGDescriptor::winSigma
  769. //
  770. public double get_winSigma()
  771. {
  772. ThrowIfDisposed();
  773. return objdetect_HOGDescriptor_get_1winSigma_10(nativeObj);
  774. }
  775. //
  776. // C++: HOGDescriptor_HistogramNormType HOGDescriptor::histogramNormType
  777. //
  778. public int get_histogramNormType()
  779. {
  780. ThrowIfDisposed();
  781. return objdetect_HOGDescriptor_get_1histogramNormType_10(nativeObj);
  782. }
  783. //
  784. // C++: double HOGDescriptor::L2HysThreshold
  785. //
  786. public double get_L2HysThreshold()
  787. {
  788. ThrowIfDisposed();
  789. return objdetect_HOGDescriptor_get_1L2HysThreshold_10(nativeObj);
  790. }
  791. //
  792. // C++: bool HOGDescriptor::gammaCorrection
  793. //
  794. public bool get_gammaCorrection()
  795. {
  796. ThrowIfDisposed();
  797. return objdetect_HOGDescriptor_get_1gammaCorrection_10(nativeObj);
  798. }
  799. //
  800. // C++: vector_float HOGDescriptor::svmDetector
  801. //
  802. public MatOfFloat get_svmDetector()
  803. {
  804. ThrowIfDisposed();
  805. return MatOfFloat.fromNativeAddr(DisposableObject.ThrowIfNullIntPtr(objdetect_HOGDescriptor_get_1svmDetector_10(nativeObj)));
  806. }
  807. //
  808. // C++: int HOGDescriptor::nlevels
  809. //
  810. public int get_nlevels()
  811. {
  812. ThrowIfDisposed();
  813. return objdetect_HOGDescriptor_get_1nlevels_10(nativeObj);
  814. }
  815. //
  816. // C++: bool HOGDescriptor::signedGradient
  817. //
  818. public bool get_signedGradient()
  819. {
  820. ThrowIfDisposed();
  821. return objdetect_HOGDescriptor_get_1signedGradient_10(nativeObj);
  822. }
  823. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  824. const string LIBNAME = "__Internal";
  825. #else
  826. const string LIBNAME = "opencvforunity";
  827. #endif
  828. // C++: cv::HOGDescriptor::HOGDescriptor()
  829. [DllImport(LIBNAME)]
  830. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_10();
  831. // 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)
  832. [DllImport(LIBNAME)]
  833. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_11(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, [MarshalAs(UnmanagedType.U1)] bool _gammaCorrection, int _nlevels, [MarshalAs(UnmanagedType.U1)] bool _signedGradient);
  834. [DllImport(LIBNAME)]
  835. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_12(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, [MarshalAs(UnmanagedType.U1)] bool _gammaCorrection, int _nlevels);
  836. [DllImport(LIBNAME)]
  837. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_13(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, [MarshalAs(UnmanagedType.U1)] bool _gammaCorrection);
  838. [DllImport(LIBNAME)]
  839. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_14(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);
  840. [DllImport(LIBNAME)]
  841. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_15(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);
  842. [DllImport(LIBNAME)]
  843. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_16(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);
  844. [DllImport(LIBNAME)]
  845. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_17(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);
  846. [DllImport(LIBNAME)]
  847. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_18(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);
  848. // C++: cv::HOGDescriptor::HOGDescriptor(String filename)
  849. [DllImport(LIBNAME)]
  850. private static extern IntPtr objdetect_HOGDescriptor_HOGDescriptor_19(string filename);
  851. // C++: size_t cv::HOGDescriptor::getDescriptorSize()
  852. [DllImport(LIBNAME)]
  853. private static extern long objdetect_HOGDescriptor_getDescriptorSize_10(IntPtr nativeObj);
  854. // C++: bool cv::HOGDescriptor::checkDetectorSize()
  855. [DllImport(LIBNAME)]
  856. [return: MarshalAs(UnmanagedType.U1)]
  857. private static extern bool objdetect_HOGDescriptor_checkDetectorSize_10(IntPtr nativeObj);
  858. // C++: double cv::HOGDescriptor::getWinSigma()
  859. [DllImport(LIBNAME)]
  860. private static extern double objdetect_HOGDescriptor_getWinSigma_10(IntPtr nativeObj);
  861. // C++: void cv::HOGDescriptor::setSVMDetector(Mat svmdetector)
  862. [DllImport(LIBNAME)]
  863. private static extern void objdetect_HOGDescriptor_setSVMDetector_10(IntPtr nativeObj, IntPtr svmdetector_nativeObj);
  864. // C++: bool cv::HOGDescriptor::load(String filename, String objname = String())
  865. [DllImport(LIBNAME)]
  866. [return: MarshalAs(UnmanagedType.U1)]
  867. private static extern bool objdetect_HOGDescriptor_load_10(IntPtr nativeObj, string filename, string objname);
  868. [DllImport(LIBNAME)]
  869. [return: MarshalAs(UnmanagedType.U1)]
  870. private static extern bool objdetect_HOGDescriptor_load_11(IntPtr nativeObj, string filename);
  871. // C++: void cv::HOGDescriptor::save(String filename, String objname = String())
  872. [DllImport(LIBNAME)]
  873. private static extern void objdetect_HOGDescriptor_save_10(IntPtr nativeObj, string filename, string objname);
  874. [DllImport(LIBNAME)]
  875. private static extern void objdetect_HOGDescriptor_save_11(IntPtr nativeObj, string filename);
  876. // C++: void cv::HOGDescriptor::compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>())
  877. [DllImport(LIBNAME)]
  878. private static extern void objdetect_HOGDescriptor_compute_10(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr descriptors_mat_nativeObj, double winStride_width, double winStride_height, double padding_width, double padding_height, IntPtr locations_mat_nativeObj);
  879. [DllImport(LIBNAME)]
  880. private static extern void objdetect_HOGDescriptor_compute_11(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr descriptors_mat_nativeObj, double winStride_width, double winStride_height, double padding_width, double padding_height);
  881. [DllImport(LIBNAME)]
  882. private static extern void objdetect_HOGDescriptor_compute_12(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr descriptors_mat_nativeObj, double winStride_width, double winStride_height);
  883. [DllImport(LIBNAME)]
  884. private static extern void objdetect_HOGDescriptor_compute_13(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr descriptors_mat_nativeObj);
  885. // 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>())
  886. [DllImport(LIBNAME)]
  887. private static extern void objdetect_HOGDescriptor_detect_10(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, IntPtr searchLocations_mat_nativeObj);
  888. [DllImport(LIBNAME)]
  889. private static extern void objdetect_HOGDescriptor_detect_11(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height);
  890. [DllImport(LIBNAME)]
  891. private static extern void objdetect_HOGDescriptor_detect_12(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr weights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height);
  892. [DllImport(LIBNAME)]
  893. private static extern void objdetect_HOGDescriptor_detect_13(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr weights_mat_nativeObj, double hitThreshold);
  894. [DllImport(LIBNAME)]
  895. private static extern void objdetect_HOGDescriptor_detect_14(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr weights_mat_nativeObj);
  896. // 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)
  897. [DllImport(LIBNAME)]
  898. private static extern void objdetect_HOGDescriptor_detectMultiScale_10(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale, double groupThreshold, [MarshalAs(UnmanagedType.U1)] bool useMeanshiftGrouping);
  899. [DllImport(LIBNAME)]
  900. private static extern void objdetect_HOGDescriptor_detectMultiScale_11(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale, double groupThreshold);
  901. [DllImport(LIBNAME)]
  902. private static extern void objdetect_HOGDescriptor_detectMultiScale_12(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height, double scale);
  903. [DllImport(LIBNAME)]
  904. private static extern void objdetect_HOGDescriptor_detectMultiScale_13(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height, double padding_width, double padding_height);
  905. [DllImport(LIBNAME)]
  906. private static extern void objdetect_HOGDescriptor_detectMultiScale_14(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold, double winStride_width, double winStride_height);
  907. [DllImport(LIBNAME)]
  908. private static extern void objdetect_HOGDescriptor_detectMultiScale_15(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj, double hitThreshold);
  909. [DllImport(LIBNAME)]
  910. private static extern void objdetect_HOGDescriptor_detectMultiScale_16(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr foundLocations_mat_nativeObj, IntPtr foundWeights_mat_nativeObj);
  911. // C++: void cv::HOGDescriptor::computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size())
  912. [DllImport(LIBNAME)]
  913. private static extern void objdetect_HOGDescriptor_computeGradient_10(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr grad_nativeObj, IntPtr angleOfs_nativeObj, double paddingTL_width, double paddingTL_height, double paddingBR_width, double paddingBR_height);
  914. [DllImport(LIBNAME)]
  915. private static extern void objdetect_HOGDescriptor_computeGradient_11(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr grad_nativeObj, IntPtr angleOfs_nativeObj, double paddingTL_width, double paddingTL_height);
  916. [DllImport(LIBNAME)]
  917. private static extern void objdetect_HOGDescriptor_computeGradient_12(IntPtr nativeObj, IntPtr img_nativeObj, IntPtr grad_nativeObj, IntPtr angleOfs_nativeObj);
  918. // C++: static vector_float cv::HOGDescriptor::getDefaultPeopleDetector()
  919. [DllImport(LIBNAME)]
  920. private static extern IntPtr objdetect_HOGDescriptor_getDefaultPeopleDetector_10();
  921. // C++: static vector_float cv::HOGDescriptor::getDaimlerPeopleDetector()
  922. [DllImport(LIBNAME)]
  923. private static extern IntPtr objdetect_HOGDescriptor_getDaimlerPeopleDetector_10();
  924. // C++: Size HOGDescriptor::winSize
  925. [DllImport(LIBNAME)]
  926. private static extern void objdetect_HOGDescriptor_get_1winSize_10(IntPtr nativeObj, double[] retVal);
  927. // C++: Size HOGDescriptor::blockSize
  928. [DllImport(LIBNAME)]
  929. private static extern void objdetect_HOGDescriptor_get_1blockSize_10(IntPtr nativeObj, double[] retVal);
  930. // C++: Size HOGDescriptor::blockStride
  931. [DllImport(LIBNAME)]
  932. private static extern void objdetect_HOGDescriptor_get_1blockStride_10(IntPtr nativeObj, double[] retVal);
  933. // C++: Size HOGDescriptor::cellSize
  934. [DllImport(LIBNAME)]
  935. private static extern void objdetect_HOGDescriptor_get_1cellSize_10(IntPtr nativeObj, double[] retVal);
  936. // C++: int HOGDescriptor::nbins
  937. [DllImport(LIBNAME)]
  938. private static extern int objdetect_HOGDescriptor_get_1nbins_10(IntPtr nativeObj);
  939. // C++: int HOGDescriptor::derivAperture
  940. [DllImport(LIBNAME)]
  941. private static extern int objdetect_HOGDescriptor_get_1derivAperture_10(IntPtr nativeObj);
  942. // C++: double HOGDescriptor::winSigma
  943. [DllImport(LIBNAME)]
  944. private static extern double objdetect_HOGDescriptor_get_1winSigma_10(IntPtr nativeObj);
  945. // C++: HOGDescriptor_HistogramNormType HOGDescriptor::histogramNormType
  946. [DllImport(LIBNAME)]
  947. private static extern int objdetect_HOGDescriptor_get_1histogramNormType_10(IntPtr nativeObj);
  948. // C++: double HOGDescriptor::L2HysThreshold
  949. [DllImport(LIBNAME)]
  950. private static extern double objdetect_HOGDescriptor_get_1L2HysThreshold_10(IntPtr nativeObj);
  951. // C++: bool HOGDescriptor::gammaCorrection
  952. [DllImport(LIBNAME)]
  953. [return: MarshalAs(UnmanagedType.U1)]
  954. private static extern bool objdetect_HOGDescriptor_get_1gammaCorrection_10(IntPtr nativeObj);
  955. // C++: vector_float HOGDescriptor::svmDetector
  956. [DllImport(LIBNAME)]
  957. private static extern IntPtr objdetect_HOGDescriptor_get_1svmDetector_10(IntPtr nativeObj);
  958. // C++: int HOGDescriptor::nlevels
  959. [DllImport(LIBNAME)]
  960. private static extern int objdetect_HOGDescriptor_get_1nlevels_10(IntPtr nativeObj);
  961. // C++: bool HOGDescriptor::signedGradient
  962. [DllImport(LIBNAME)]
  963. [return: MarshalAs(UnmanagedType.U1)]
  964. private static extern bool objdetect_HOGDescriptor_get_1signedGradient_10(IntPtr nativeObj);
  965. // native support for java finalize()
  966. [DllImport(LIBNAME)]
  967. private static extern void objdetect_HOGDescriptor_delete(IntPtr nativeObj);
  968. }
  969. }