Xphoto.cs 90 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.XphotoModule
  7. {
  8. // C++: class Xphoto
  9. public class Xphoto
  10. {
  11. // C++: enum cv.xphoto.Bm3dSteps
  12. public const int BM3D_STEPALL = 0;
  13. public const int BM3D_STEP1 = 1;
  14. public const int BM3D_STEP2 = 2;
  15. // C++: enum cv.xphoto.InpaintTypes
  16. public const int INPAINT_SHIFTMAP = 0;
  17. public const int INPAINT_FSR_BEST = 1;
  18. public const int INPAINT_FSR_FAST = 2;
  19. // C++: enum cv.xphoto.TransformTypes
  20. public const int HAAR = 0;
  21. //
  22. // C++: void cv::xphoto::bm3dDenoising(Mat src, Mat& dstStep1, Mat& dstStep2, float h = 1, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2.0f, int normType = cv::NORM_L2, int step = cv::xphoto::BM3D_STEPALL, int transformType = cv::xphoto::HAAR)
  23. //
  24. /**
  25. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  26. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  27. * optimizations. Noise expected to be a gaussian white noise.
  28. *
  29. * param src Input 8-bit or 16-bit 1-channel image.
  30. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  31. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  32. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  33. * removes image details, smaller h value preserves details but also preserves some noise.
  34. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  35. * Should be power of 2.
  36. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  37. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  38. * Must be larger than templateWindowSize.
  39. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  40. * i.e. maximum distance for which two blocks are considered similar.
  41. * Value expressed in euclidean distance.
  42. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  43. * i.e. maximum distance for which two blocks are considered similar.
  44. * Value expressed in euclidean distance.
  45. * param groupSize Maximum size of the 3D group for collaborative filtering.
  46. * param slidingStep Sliding step to process every next reference block.
  47. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  48. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  49. * set beta to zero.
  50. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  51. * but yields more accurate results.
  52. * param step Step of BM3D to be executed. Possible variants are: step 1, step 2, both steps.
  53. * param transformType Type of the orthogonal transform used in collaborative filtering step.
  54. * Currently only Haar transform is supported.
  55. *
  56. * This function expected to be applied to grayscale images. Advanced usage of this function
  57. * can be manual denoising of colored image in different colorspaces.
  58. *
  59. * SEE:
  60. * fastNlMeansDenoising
  61. */
  62. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step, int transformType)
  63. {
  64. if (src != null) src.ThrowIfDisposed();
  65. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  66. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  67. xphoto_Xphoto_bm3dDenoising_10(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType, step, transformType);
  68. }
  69. /**
  70. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  71. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  72. * optimizations. Noise expected to be a gaussian white noise.
  73. *
  74. * param src Input 8-bit or 16-bit 1-channel image.
  75. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  76. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  77. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  78. * removes image details, smaller h value preserves details but also preserves some noise.
  79. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  80. * Should be power of 2.
  81. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  82. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  83. * Must be larger than templateWindowSize.
  84. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  85. * i.e. maximum distance for which two blocks are considered similar.
  86. * Value expressed in euclidean distance.
  87. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  88. * i.e. maximum distance for which two blocks are considered similar.
  89. * Value expressed in euclidean distance.
  90. * param groupSize Maximum size of the 3D group for collaborative filtering.
  91. * param slidingStep Sliding step to process every next reference block.
  92. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  93. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  94. * set beta to zero.
  95. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  96. * but yields more accurate results.
  97. * param step Step of BM3D to be executed. Possible variants are: step 1, step 2, both steps.
  98. * Currently only Haar transform is supported.
  99. *
  100. * This function expected to be applied to grayscale images. Advanced usage of this function
  101. * can be manual denoising of colored image in different colorspaces.
  102. *
  103. * SEE:
  104. * fastNlMeansDenoising
  105. */
  106. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step)
  107. {
  108. if (src != null) src.ThrowIfDisposed();
  109. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  110. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  111. xphoto_Xphoto_bm3dDenoising_11(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType, step);
  112. }
  113. /**
  114. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  115. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  116. * optimizations. Noise expected to be a gaussian white noise.
  117. *
  118. * param src Input 8-bit or 16-bit 1-channel image.
  119. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  120. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  121. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  122. * removes image details, smaller h value preserves details but also preserves some noise.
  123. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  124. * Should be power of 2.
  125. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  126. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  127. * Must be larger than templateWindowSize.
  128. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  129. * i.e. maximum distance for which two blocks are considered similar.
  130. * Value expressed in euclidean distance.
  131. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  132. * i.e. maximum distance for which two blocks are considered similar.
  133. * Value expressed in euclidean distance.
  134. * param groupSize Maximum size of the 3D group for collaborative filtering.
  135. * param slidingStep Sliding step to process every next reference block.
  136. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  137. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  138. * set beta to zero.
  139. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  140. * but yields more accurate results.
  141. * Currently only Haar transform is supported.
  142. *
  143. * This function expected to be applied to grayscale images. Advanced usage of this function
  144. * can be manual denoising of colored image in different colorspaces.
  145. *
  146. * SEE:
  147. * fastNlMeansDenoising
  148. */
  149. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType)
  150. {
  151. if (src != null) src.ThrowIfDisposed();
  152. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  153. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  154. xphoto_Xphoto_bm3dDenoising_12(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType);
  155. }
  156. /**
  157. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  158. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  159. * optimizations. Noise expected to be a gaussian white noise.
  160. *
  161. * param src Input 8-bit or 16-bit 1-channel image.
  162. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  163. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  164. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  165. * removes image details, smaller h value preserves details but also preserves some noise.
  166. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  167. * Should be power of 2.
  168. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  169. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  170. * Must be larger than templateWindowSize.
  171. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  172. * i.e. maximum distance for which two blocks are considered similar.
  173. * Value expressed in euclidean distance.
  174. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  175. * i.e. maximum distance for which two blocks are considered similar.
  176. * Value expressed in euclidean distance.
  177. * param groupSize Maximum size of the 3D group for collaborative filtering.
  178. * param slidingStep Sliding step to process every next reference block.
  179. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  180. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  181. * set beta to zero.
  182. * but yields more accurate results.
  183. * Currently only Haar transform is supported.
  184. *
  185. * This function expected to be applied to grayscale images. Advanced usage of this function
  186. * can be manual denoising of colored image in different colorspaces.
  187. *
  188. * SEE:
  189. * fastNlMeansDenoising
  190. */
  191. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta)
  192. {
  193. if (src != null) src.ThrowIfDisposed();
  194. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  195. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  196. xphoto_Xphoto_bm3dDenoising_13(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta);
  197. }
  198. /**
  199. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  200. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  201. * optimizations. Noise expected to be a gaussian white noise.
  202. *
  203. * param src Input 8-bit or 16-bit 1-channel image.
  204. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  205. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  206. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  207. * removes image details, smaller h value preserves details but also preserves some noise.
  208. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  209. * Should be power of 2.
  210. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  211. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  212. * Must be larger than templateWindowSize.
  213. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  214. * i.e. maximum distance for which two blocks are considered similar.
  215. * Value expressed in euclidean distance.
  216. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  217. * i.e. maximum distance for which two blocks are considered similar.
  218. * Value expressed in euclidean distance.
  219. * param groupSize Maximum size of the 3D group for collaborative filtering.
  220. * param slidingStep Sliding step to process every next reference block.
  221. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  222. * set beta to zero.
  223. * but yields more accurate results.
  224. * Currently only Haar transform is supported.
  225. *
  226. * This function expected to be applied to grayscale images. Advanced usage of this function
  227. * can be manual denoising of colored image in different colorspaces.
  228. *
  229. * SEE:
  230. * fastNlMeansDenoising
  231. */
  232. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep)
  233. {
  234. if (src != null) src.ThrowIfDisposed();
  235. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  236. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  237. xphoto_Xphoto_bm3dDenoising_14(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep);
  238. }
  239. /**
  240. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  241. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  242. * optimizations. Noise expected to be a gaussian white noise.
  243. *
  244. * param src Input 8-bit or 16-bit 1-channel image.
  245. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  246. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  247. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  248. * removes image details, smaller h value preserves details but also preserves some noise.
  249. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  250. * Should be power of 2.
  251. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  252. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  253. * Must be larger than templateWindowSize.
  254. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  255. * i.e. maximum distance for which two blocks are considered similar.
  256. * Value expressed in euclidean distance.
  257. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  258. * i.e. maximum distance for which two blocks are considered similar.
  259. * Value expressed in euclidean distance.
  260. * param groupSize Maximum size of the 3D group for collaborative filtering.
  261. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  262. * set beta to zero.
  263. * but yields more accurate results.
  264. * Currently only Haar transform is supported.
  265. *
  266. * This function expected to be applied to grayscale images. Advanced usage of this function
  267. * can be manual denoising of colored image in different colorspaces.
  268. *
  269. * SEE:
  270. * fastNlMeansDenoising
  271. */
  272. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize)
  273. {
  274. if (src != null) src.ThrowIfDisposed();
  275. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  276. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  277. xphoto_Xphoto_bm3dDenoising_15(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize);
  278. }
  279. /**
  280. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  281. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  282. * optimizations. Noise expected to be a gaussian white noise.
  283. *
  284. * param src Input 8-bit or 16-bit 1-channel image.
  285. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  286. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  287. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  288. * removes image details, smaller h value preserves details but also preserves some noise.
  289. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  290. * Should be power of 2.
  291. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  292. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  293. * Must be larger than templateWindowSize.
  294. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  295. * i.e. maximum distance for which two blocks are considered similar.
  296. * Value expressed in euclidean distance.
  297. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  298. * i.e. maximum distance for which two blocks are considered similar.
  299. * Value expressed in euclidean distance.
  300. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  301. * set beta to zero.
  302. * but yields more accurate results.
  303. * Currently only Haar transform is supported.
  304. *
  305. * This function expected to be applied to grayscale images. Advanced usage of this function
  306. * can be manual denoising of colored image in different colorspaces.
  307. *
  308. * SEE:
  309. * fastNlMeansDenoising
  310. */
  311. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2)
  312. {
  313. if (src != null) src.ThrowIfDisposed();
  314. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  315. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  316. xphoto_Xphoto_bm3dDenoising_16(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2);
  317. }
  318. /**
  319. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  320. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  321. * optimizations. Noise expected to be a gaussian white noise.
  322. *
  323. * param src Input 8-bit or 16-bit 1-channel image.
  324. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  325. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  326. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  327. * removes image details, smaller h value preserves details but also preserves some noise.
  328. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  329. * Should be power of 2.
  330. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  331. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  332. * Must be larger than templateWindowSize.
  333. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  334. * i.e. maximum distance for which two blocks are considered similar.
  335. * Value expressed in euclidean distance.
  336. * i.e. maximum distance for which two blocks are considered similar.
  337. * Value expressed in euclidean distance.
  338. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  339. * set beta to zero.
  340. * but yields more accurate results.
  341. * Currently only Haar transform is supported.
  342. *
  343. * This function expected to be applied to grayscale images. Advanced usage of this function
  344. * can be manual denoising of colored image in different colorspaces.
  345. *
  346. * SEE:
  347. * fastNlMeansDenoising
  348. */
  349. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1)
  350. {
  351. if (src != null) src.ThrowIfDisposed();
  352. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  353. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  354. xphoto_Xphoto_bm3dDenoising_17(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1);
  355. }
  356. /**
  357. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  358. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  359. * optimizations. Noise expected to be a gaussian white noise.
  360. *
  361. * param src Input 8-bit or 16-bit 1-channel image.
  362. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  363. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  364. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  365. * removes image details, smaller h value preserves details but also preserves some noise.
  366. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  367. * Should be power of 2.
  368. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  369. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  370. * Must be larger than templateWindowSize.
  371. * i.e. maximum distance for which two blocks are considered similar.
  372. * Value expressed in euclidean distance.
  373. * i.e. maximum distance for which two blocks are considered similar.
  374. * Value expressed in euclidean distance.
  375. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  376. * set beta to zero.
  377. * but yields more accurate results.
  378. * Currently only Haar transform is supported.
  379. *
  380. * This function expected to be applied to grayscale images. Advanced usage of this function
  381. * can be manual denoising of colored image in different colorspaces.
  382. *
  383. * SEE:
  384. * fastNlMeansDenoising
  385. */
  386. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize, int searchWindowSize)
  387. {
  388. if (src != null) src.ThrowIfDisposed();
  389. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  390. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  391. xphoto_Xphoto_bm3dDenoising_18(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize, searchWindowSize);
  392. }
  393. /**
  394. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  395. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  396. * optimizations. Noise expected to be a gaussian white noise.
  397. *
  398. * param src Input 8-bit or 16-bit 1-channel image.
  399. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  400. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  401. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  402. * removes image details, smaller h value preserves details but also preserves some noise.
  403. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  404. * Should be power of 2.
  405. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  406. * Must be larger than templateWindowSize.
  407. * i.e. maximum distance for which two blocks are considered similar.
  408. * Value expressed in euclidean distance.
  409. * i.e. maximum distance for which two blocks are considered similar.
  410. * Value expressed in euclidean distance.
  411. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  412. * set beta to zero.
  413. * but yields more accurate results.
  414. * Currently only Haar transform is supported.
  415. *
  416. * This function expected to be applied to grayscale images. Advanced usage of this function
  417. * can be manual denoising of colored image in different colorspaces.
  418. *
  419. * SEE:
  420. * fastNlMeansDenoising
  421. */
  422. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h, int templateWindowSize)
  423. {
  424. if (src != null) src.ThrowIfDisposed();
  425. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  426. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  427. xphoto_Xphoto_bm3dDenoising_19(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h, templateWindowSize);
  428. }
  429. /**
  430. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  431. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  432. * optimizations. Noise expected to be a gaussian white noise.
  433. *
  434. * param src Input 8-bit or 16-bit 1-channel image.
  435. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  436. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  437. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  438. * removes image details, smaller h value preserves details but also preserves some noise.
  439. * Should be power of 2.
  440. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  441. * Must be larger than templateWindowSize.
  442. * i.e. maximum distance for which two blocks are considered similar.
  443. * Value expressed in euclidean distance.
  444. * i.e. maximum distance for which two blocks are considered similar.
  445. * Value expressed in euclidean distance.
  446. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  447. * set beta to zero.
  448. * but yields more accurate results.
  449. * Currently only Haar transform is supported.
  450. *
  451. * This function expected to be applied to grayscale images. Advanced usage of this function
  452. * can be manual denoising of colored image in different colorspaces.
  453. *
  454. * SEE:
  455. * fastNlMeansDenoising
  456. */
  457. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2, float h)
  458. {
  459. if (src != null) src.ThrowIfDisposed();
  460. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  461. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  462. xphoto_Xphoto_bm3dDenoising_110(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj, h);
  463. }
  464. /**
  465. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  466. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  467. * optimizations. Noise expected to be a gaussian white noise.
  468. *
  469. * param src Input 8-bit or 16-bit 1-channel image.
  470. * param dstStep1 Output image of the first step of BM3D with the same size and type as src.
  471. * param dstStep2 Output image of the second step of BM3D with the same size and type as src.
  472. * removes image details, smaller h value preserves details but also preserves some noise.
  473. * Should be power of 2.
  474. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  475. * Must be larger than templateWindowSize.
  476. * i.e. maximum distance for which two blocks are considered similar.
  477. * Value expressed in euclidean distance.
  478. * i.e. maximum distance for which two blocks are considered similar.
  479. * Value expressed in euclidean distance.
  480. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  481. * set beta to zero.
  482. * but yields more accurate results.
  483. * Currently only Haar transform is supported.
  484. *
  485. * This function expected to be applied to grayscale images. Advanced usage of this function
  486. * can be manual denoising of colored image in different colorspaces.
  487. *
  488. * SEE:
  489. * fastNlMeansDenoising
  490. */
  491. public static void bm3dDenoising(Mat src, Mat dstStep1, Mat dstStep2)
  492. {
  493. if (src != null) src.ThrowIfDisposed();
  494. if (dstStep1 != null) dstStep1.ThrowIfDisposed();
  495. if (dstStep2 != null) dstStep2.ThrowIfDisposed();
  496. xphoto_Xphoto_bm3dDenoising_111(src.nativeObj, dstStep1.nativeObj, dstStep2.nativeObj);
  497. }
  498. //
  499. // C++: void cv::xphoto::bm3dDenoising(Mat src, Mat& dst, float h = 1, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2.0f, int normType = cv::NORM_L2, int step = cv::xphoto::BM3D_STEPALL, int transformType = cv::xphoto::HAAR)
  500. //
  501. /**
  502. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  503. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  504. * optimizations. Noise expected to be a gaussian white noise.
  505. *
  506. * param src Input 8-bit or 16-bit 1-channel image.
  507. * param dst Output image with the same size and type as src.
  508. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  509. * removes image details, smaller h value preserves details but also preserves some noise.
  510. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  511. * Should be power of 2.
  512. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  513. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  514. * Must be larger than templateWindowSize.
  515. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  516. * i.e. maximum distance for which two blocks are considered similar.
  517. * Value expressed in euclidean distance.
  518. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  519. * i.e. maximum distance for which two blocks are considered similar.
  520. * Value expressed in euclidean distance.
  521. * param groupSize Maximum size of the 3D group for collaborative filtering.
  522. * param slidingStep Sliding step to process every next reference block.
  523. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  524. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  525. * set beta to zero.
  526. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  527. * but yields more accurate results.
  528. * param step Step of BM3D to be executed. Allowed are only BM3D_STEP1 and BM3D_STEPALL.
  529. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  530. * param transformType Type of the orthogonal transform used in collaborative filtering step.
  531. * Currently only Haar transform is supported.
  532. *
  533. * This function expected to be applied to grayscale images. Advanced usage of this function
  534. * can be manual denoising of colored image in different colorspaces.
  535. *
  536. * SEE:
  537. * fastNlMeansDenoising
  538. */
  539. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step, int transformType)
  540. {
  541. if (src != null) src.ThrowIfDisposed();
  542. if (dst != null) dst.ThrowIfDisposed();
  543. xphoto_Xphoto_bm3dDenoising_112(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType, step, transformType);
  544. }
  545. /**
  546. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  547. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  548. * optimizations. Noise expected to be a gaussian white noise.
  549. *
  550. * param src Input 8-bit or 16-bit 1-channel image.
  551. * param dst Output image with the same size and type as src.
  552. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  553. * removes image details, smaller h value preserves details but also preserves some noise.
  554. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  555. * Should be power of 2.
  556. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  557. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  558. * Must be larger than templateWindowSize.
  559. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  560. * i.e. maximum distance for which two blocks are considered similar.
  561. * Value expressed in euclidean distance.
  562. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  563. * i.e. maximum distance for which two blocks are considered similar.
  564. * Value expressed in euclidean distance.
  565. * param groupSize Maximum size of the 3D group for collaborative filtering.
  566. * param slidingStep Sliding step to process every next reference block.
  567. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  568. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  569. * set beta to zero.
  570. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  571. * but yields more accurate results.
  572. * param step Step of BM3D to be executed. Allowed are only BM3D_STEP1 and BM3D_STEPALL.
  573. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  574. * Currently only Haar transform is supported.
  575. *
  576. * This function expected to be applied to grayscale images. Advanced usage of this function
  577. * can be manual denoising of colored image in different colorspaces.
  578. *
  579. * SEE:
  580. * fastNlMeansDenoising
  581. */
  582. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step)
  583. {
  584. if (src != null) src.ThrowIfDisposed();
  585. if (dst != null) dst.ThrowIfDisposed();
  586. xphoto_Xphoto_bm3dDenoising_113(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType, step);
  587. }
  588. /**
  589. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  590. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  591. * optimizations. Noise expected to be a gaussian white noise.
  592. *
  593. * param src Input 8-bit or 16-bit 1-channel image.
  594. * param dst Output image with the same size and type as src.
  595. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  596. * removes image details, smaller h value preserves details but also preserves some noise.
  597. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  598. * Should be power of 2.
  599. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  600. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  601. * Must be larger than templateWindowSize.
  602. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  603. * i.e. maximum distance for which two blocks are considered similar.
  604. * Value expressed in euclidean distance.
  605. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  606. * i.e. maximum distance for which two blocks are considered similar.
  607. * Value expressed in euclidean distance.
  608. * param groupSize Maximum size of the 3D group for collaborative filtering.
  609. * param slidingStep Sliding step to process every next reference block.
  610. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  611. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  612. * set beta to zero.
  613. * param normType Norm used to calculate distance between blocks. L2 is slower than L1
  614. * but yields more accurate results.
  615. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  616. * Currently only Haar transform is supported.
  617. *
  618. * This function expected to be applied to grayscale images. Advanced usage of this function
  619. * can be manual denoising of colored image in different colorspaces.
  620. *
  621. * SEE:
  622. * fastNlMeansDenoising
  623. */
  624. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType)
  625. {
  626. if (src != null) src.ThrowIfDisposed();
  627. if (dst != null) dst.ThrowIfDisposed();
  628. xphoto_Xphoto_bm3dDenoising_114(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta, normType);
  629. }
  630. /**
  631. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  632. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  633. * optimizations. Noise expected to be a gaussian white noise.
  634. *
  635. * param src Input 8-bit or 16-bit 1-channel image.
  636. * param dst Output image with the same size and type as src.
  637. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  638. * removes image details, smaller h value preserves details but also preserves some noise.
  639. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  640. * Should be power of 2.
  641. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  642. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  643. * Must be larger than templateWindowSize.
  644. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  645. * i.e. maximum distance for which two blocks are considered similar.
  646. * Value expressed in euclidean distance.
  647. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  648. * i.e. maximum distance for which two blocks are considered similar.
  649. * Value expressed in euclidean distance.
  650. * param groupSize Maximum size of the 3D group for collaborative filtering.
  651. * param slidingStep Sliding step to process every next reference block.
  652. * param beta Kaiser window parameter that affects the sidelobe attenuation of the transform of the
  653. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  654. * set beta to zero.
  655. * but yields more accurate results.
  656. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  657. * Currently only Haar transform is supported.
  658. *
  659. * This function expected to be applied to grayscale images. Advanced usage of this function
  660. * can be manual denoising of colored image in different colorspaces.
  661. *
  662. * SEE:
  663. * fastNlMeansDenoising
  664. */
  665. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta)
  666. {
  667. if (src != null) src.ThrowIfDisposed();
  668. if (dst != null) dst.ThrowIfDisposed();
  669. xphoto_Xphoto_bm3dDenoising_115(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep, beta);
  670. }
  671. /**
  672. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  673. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  674. * optimizations. Noise expected to be a gaussian white noise.
  675. *
  676. * param src Input 8-bit or 16-bit 1-channel image.
  677. * param dst Output image with the same size and type as src.
  678. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  679. * removes image details, smaller h value preserves details but also preserves some noise.
  680. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  681. * Should be power of 2.
  682. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  683. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  684. * Must be larger than templateWindowSize.
  685. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  686. * i.e. maximum distance for which two blocks are considered similar.
  687. * Value expressed in euclidean distance.
  688. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  689. * i.e. maximum distance for which two blocks are considered similar.
  690. * Value expressed in euclidean distance.
  691. * param groupSize Maximum size of the 3D group for collaborative filtering.
  692. * param slidingStep Sliding step to process every next reference block.
  693. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  694. * set beta to zero.
  695. * but yields more accurate results.
  696. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  697. * Currently only Haar transform is supported.
  698. *
  699. * This function expected to be applied to grayscale images. Advanced usage of this function
  700. * can be manual denoising of colored image in different colorspaces.
  701. *
  702. * SEE:
  703. * fastNlMeansDenoising
  704. */
  705. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep)
  706. {
  707. if (src != null) src.ThrowIfDisposed();
  708. if (dst != null) dst.ThrowIfDisposed();
  709. xphoto_Xphoto_bm3dDenoising_116(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep);
  710. }
  711. /**
  712. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  713. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  714. * optimizations. Noise expected to be a gaussian white noise.
  715. *
  716. * param src Input 8-bit or 16-bit 1-channel image.
  717. * param dst Output image with the same size and type as src.
  718. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  719. * removes image details, smaller h value preserves details but also preserves some noise.
  720. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  721. * Should be power of 2.
  722. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  723. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  724. * Must be larger than templateWindowSize.
  725. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  726. * i.e. maximum distance for which two blocks are considered similar.
  727. * Value expressed in euclidean distance.
  728. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  729. * i.e. maximum distance for which two blocks are considered similar.
  730. * Value expressed in euclidean distance.
  731. * param groupSize Maximum size of the 3D group for collaborative filtering.
  732. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  733. * set beta to zero.
  734. * but yields more accurate results.
  735. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  736. * Currently only Haar transform is supported.
  737. *
  738. * This function expected to be applied to grayscale images. Advanced usage of this function
  739. * can be manual denoising of colored image in different colorspaces.
  740. *
  741. * SEE:
  742. * fastNlMeansDenoising
  743. */
  744. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize)
  745. {
  746. if (src != null) src.ThrowIfDisposed();
  747. if (dst != null) dst.ThrowIfDisposed();
  748. xphoto_Xphoto_bm3dDenoising_117(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2, groupSize);
  749. }
  750. /**
  751. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  752. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  753. * optimizations. Noise expected to be a gaussian white noise.
  754. *
  755. * param src Input 8-bit or 16-bit 1-channel image.
  756. * param dst Output image with the same size and type as src.
  757. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  758. * removes image details, smaller h value preserves details but also preserves some noise.
  759. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  760. * Should be power of 2.
  761. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  762. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  763. * Must be larger than templateWindowSize.
  764. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  765. * i.e. maximum distance for which two blocks are considered similar.
  766. * Value expressed in euclidean distance.
  767. * param blockMatchingStep2 Block matching threshold for the second step of BM3D (Wiener filtering),
  768. * i.e. maximum distance for which two blocks are considered similar.
  769. * Value expressed in euclidean distance.
  770. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  771. * set beta to zero.
  772. * but yields more accurate results.
  773. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  774. * Currently only Haar transform is supported.
  775. *
  776. * This function expected to be applied to grayscale images. Advanced usage of this function
  777. * can be manual denoising of colored image in different colorspaces.
  778. *
  779. * SEE:
  780. * fastNlMeansDenoising
  781. */
  782. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2)
  783. {
  784. if (src != null) src.ThrowIfDisposed();
  785. if (dst != null) dst.ThrowIfDisposed();
  786. xphoto_Xphoto_bm3dDenoising_118(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1, blockMatchingStep2);
  787. }
  788. /**
  789. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  790. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  791. * optimizations. Noise expected to be a gaussian white noise.
  792. *
  793. * param src Input 8-bit or 16-bit 1-channel image.
  794. * param dst Output image with the same size and type as src.
  795. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  796. * removes image details, smaller h value preserves details but also preserves some noise.
  797. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  798. * Should be power of 2.
  799. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  800. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  801. * Must be larger than templateWindowSize.
  802. * param blockMatchingStep1 Block matching threshold for the first step of BM3D (hard thresholding),
  803. * i.e. maximum distance for which two blocks are considered similar.
  804. * Value expressed in euclidean distance.
  805. * i.e. maximum distance for which two blocks are considered similar.
  806. * Value expressed in euclidean distance.
  807. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  808. * set beta to zero.
  809. * but yields more accurate results.
  810. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  811. * Currently only Haar transform is supported.
  812. *
  813. * This function expected to be applied to grayscale images. Advanced usage of this function
  814. * can be manual denoising of colored image in different colorspaces.
  815. *
  816. * SEE:
  817. * fastNlMeansDenoising
  818. */
  819. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1)
  820. {
  821. if (src != null) src.ThrowIfDisposed();
  822. if (dst != null) dst.ThrowIfDisposed();
  823. xphoto_Xphoto_bm3dDenoising_119(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize, blockMatchingStep1);
  824. }
  825. /**
  826. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  827. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  828. * optimizations. Noise expected to be a gaussian white noise.
  829. *
  830. * param src Input 8-bit or 16-bit 1-channel image.
  831. * param dst Output image with the same size and type as src.
  832. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  833. * removes image details, smaller h value preserves details but also preserves some noise.
  834. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  835. * Should be power of 2.
  836. * param searchWindowSize Size in pixels of the window that is used to perform block-matching.
  837. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  838. * Must be larger than templateWindowSize.
  839. * i.e. maximum distance for which two blocks are considered similar.
  840. * Value expressed in euclidean distance.
  841. * i.e. maximum distance for which two blocks are considered similar.
  842. * Value expressed in euclidean distance.
  843. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  844. * set beta to zero.
  845. * but yields more accurate results.
  846. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  847. * Currently only Haar transform is supported.
  848. *
  849. * This function expected to be applied to grayscale images. Advanced usage of this function
  850. * can be manual denoising of colored image in different colorspaces.
  851. *
  852. * SEE:
  853. * fastNlMeansDenoising
  854. */
  855. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize, int searchWindowSize)
  856. {
  857. if (src != null) src.ThrowIfDisposed();
  858. if (dst != null) dst.ThrowIfDisposed();
  859. xphoto_Xphoto_bm3dDenoising_120(src.nativeObj, dst.nativeObj, h, templateWindowSize, searchWindowSize);
  860. }
  861. /**
  862. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  863. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  864. * optimizations. Noise expected to be a gaussian white noise.
  865. *
  866. * param src Input 8-bit or 16-bit 1-channel image.
  867. * param dst Output image with the same size and type as src.
  868. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  869. * removes image details, smaller h value preserves details but also preserves some noise.
  870. * param templateWindowSize Size in pixels of the template patch that is used for block-matching.
  871. * Should be power of 2.
  872. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  873. * Must be larger than templateWindowSize.
  874. * i.e. maximum distance for which two blocks are considered similar.
  875. * Value expressed in euclidean distance.
  876. * i.e. maximum distance for which two blocks are considered similar.
  877. * Value expressed in euclidean distance.
  878. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  879. * set beta to zero.
  880. * but yields more accurate results.
  881. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  882. * Currently only Haar transform is supported.
  883. *
  884. * This function expected to be applied to grayscale images. Advanced usage of this function
  885. * can be manual denoising of colored image in different colorspaces.
  886. *
  887. * SEE:
  888. * fastNlMeansDenoising
  889. */
  890. public static void bm3dDenoising(Mat src, Mat dst, float h, int templateWindowSize)
  891. {
  892. if (src != null) src.ThrowIfDisposed();
  893. if (dst != null) dst.ThrowIfDisposed();
  894. xphoto_Xphoto_bm3dDenoising_121(src.nativeObj, dst.nativeObj, h, templateWindowSize);
  895. }
  896. /**
  897. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  898. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  899. * optimizations. Noise expected to be a gaussian white noise.
  900. *
  901. * param src Input 8-bit or 16-bit 1-channel image.
  902. * param dst Output image with the same size and type as src.
  903. * param h Parameter regulating filter strength. Big h value perfectly removes noise but also
  904. * removes image details, smaller h value preserves details but also preserves some noise.
  905. * Should be power of 2.
  906. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  907. * Must be larger than templateWindowSize.
  908. * i.e. maximum distance for which two blocks are considered similar.
  909. * Value expressed in euclidean distance.
  910. * i.e. maximum distance for which two blocks are considered similar.
  911. * Value expressed in euclidean distance.
  912. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  913. * set beta to zero.
  914. * but yields more accurate results.
  915. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  916. * Currently only Haar transform is supported.
  917. *
  918. * This function expected to be applied to grayscale images. Advanced usage of this function
  919. * can be manual denoising of colored image in different colorspaces.
  920. *
  921. * SEE:
  922. * fastNlMeansDenoising
  923. */
  924. public static void bm3dDenoising(Mat src, Mat dst, float h)
  925. {
  926. if (src != null) src.ThrowIfDisposed();
  927. if (dst != null) dst.ThrowIfDisposed();
  928. xphoto_Xphoto_bm3dDenoising_122(src.nativeObj, dst.nativeObj, h);
  929. }
  930. /**
  931. * Performs image denoising using the Block-Matching and 3D-filtering algorithm
  932. * <http://www.cs.tut.fi/~foi/GCF-BM3D/BM3D_TIP_2007.pdf> with several computational
  933. * optimizations. Noise expected to be a gaussian white noise.
  934. *
  935. * param src Input 8-bit or 16-bit 1-channel image.
  936. * param dst Output image with the same size and type as src.
  937. * removes image details, smaller h value preserves details but also preserves some noise.
  938. * Should be power of 2.
  939. * Affect performance linearly: greater searchWindowsSize - greater denoising time.
  940. * Must be larger than templateWindowSize.
  941. * i.e. maximum distance for which two blocks are considered similar.
  942. * Value expressed in euclidean distance.
  943. * i.e. maximum distance for which two blocks are considered similar.
  944. * Value expressed in euclidean distance.
  945. * window. Kaiser window is used in order to reduce border effects. To prevent usage of the window,
  946. * set beta to zero.
  947. * but yields more accurate results.
  948. * BM3D_STEP2 is not allowed as it requires basic estimate to be present.
  949. * Currently only Haar transform is supported.
  950. *
  951. * This function expected to be applied to grayscale images. Advanced usage of this function
  952. * can be manual denoising of colored image in different colorspaces.
  953. *
  954. * SEE:
  955. * fastNlMeansDenoising
  956. */
  957. public static void bm3dDenoising(Mat src, Mat dst)
  958. {
  959. if (src != null) src.ThrowIfDisposed();
  960. if (dst != null) dst.ThrowIfDisposed();
  961. xphoto_Xphoto_bm3dDenoising_123(src.nativeObj, dst.nativeObj);
  962. }
  963. //
  964. // C++: void cv::xphoto::dctDenoising(Mat src, Mat dst, double sigma, int psize = 16)
  965. //
  966. /**
  967. * The function implements simple dct-based denoising
  968. *
  969. * <http://www.ipol.im/pub/art/2011/ys-dct/>.
  970. * param src source image
  971. * param dst destination image
  972. * param sigma expected noise standard deviation
  973. * param psize size of block side where dct is computed
  974. *
  975. * SEE:
  976. * fastNlMeansDenoising
  977. */
  978. public static void dctDenoising(Mat src, Mat dst, double sigma, int psize)
  979. {
  980. if (src != null) src.ThrowIfDisposed();
  981. if (dst != null) dst.ThrowIfDisposed();
  982. xphoto_Xphoto_dctDenoising_10(src.nativeObj, dst.nativeObj, sigma, psize);
  983. }
  984. /**
  985. * The function implements simple dct-based denoising
  986. *
  987. * <http://www.ipol.im/pub/art/2011/ys-dct/>.
  988. * param src source image
  989. * param dst destination image
  990. * param sigma expected noise standard deviation
  991. *
  992. * SEE:
  993. * fastNlMeansDenoising
  994. */
  995. public static void dctDenoising(Mat src, Mat dst, double sigma)
  996. {
  997. if (src != null) src.ThrowIfDisposed();
  998. if (dst != null) dst.ThrowIfDisposed();
  999. xphoto_Xphoto_dctDenoising_11(src.nativeObj, dst.nativeObj, sigma);
  1000. }
  1001. //
  1002. // C++: void cv::xphoto::inpaint(Mat src, Mat mask, Mat dst, int algorithmType)
  1003. //
  1004. /**
  1005. * The function implements different single-image inpainting algorithms.
  1006. *
  1007. * See the original papers CITE: He2012 (Shiftmap) or CITE: GenserPCS2018 and CITE: SeilerTIP2015 (FSR) for details.
  1008. *
  1009. * param src source image
  1010. * <ul>
  1011. * <li>
  1012. * #INPAINT_SHIFTMAP: it could be of any type and any number of channels from 1 to 4. In case of
  1013. * 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first
  1014. * color component shows intensity, while second and third shows colors. Nonetheless you can try any
  1015. * colorspaces.
  1016. * </li>
  1017. * <li>
  1018. * #INPAINT_FSR_BEST or #INPAINT_FSR_FAST: 1-channel grayscale or 3-channel BGR image.
  1019. * </li>
  1020. * </ul>
  1021. * param mask mask (#CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels
  1022. * indicate area to be inpainted
  1023. * param dst destination image
  1024. * param algorithmType see xphoto::InpaintTypes
  1025. */
  1026. public static void inpaint(Mat src, Mat mask, Mat dst, int algorithmType)
  1027. {
  1028. if (src != null) src.ThrowIfDisposed();
  1029. if (mask != null) mask.ThrowIfDisposed();
  1030. if (dst != null) dst.ThrowIfDisposed();
  1031. xphoto_Xphoto_inpaint_10(src.nativeObj, mask.nativeObj, dst.nativeObj, algorithmType);
  1032. }
  1033. //
  1034. // C++: void cv::xphoto::oilPainting(Mat src, Mat& dst, int size, int dynRatio, int code)
  1035. //
  1036. /**
  1037. * oilPainting
  1038. * See the book CITE: Holzmann1988 for details.
  1039. * param src Input three-channel or one channel image (either CV_8UC3 or CV_8UC1)
  1040. * param dst Output image of the same size and type as src.
  1041. * param size neighbouring size is 2-size+1
  1042. * param dynRatio image is divided by dynRatio before histogram processing
  1043. * param code automatically generated
  1044. */
  1045. public static void oilPainting(Mat src, Mat dst, int size, int dynRatio, int code)
  1046. {
  1047. if (src != null) src.ThrowIfDisposed();
  1048. if (dst != null) dst.ThrowIfDisposed();
  1049. xphoto_Xphoto_oilPainting_10(src.nativeObj, dst.nativeObj, size, dynRatio, code);
  1050. }
  1051. //
  1052. // C++: void cv::xphoto::oilPainting(Mat src, Mat& dst, int size, int dynRatio)
  1053. //
  1054. /**
  1055. * oilPainting
  1056. * See the book CITE: Holzmann1988 for details.
  1057. * param src Input three-channel or one channel image (either CV_8UC3 or CV_8UC1)
  1058. * param dst Output image of the same size and type as src.
  1059. * param size neighbouring size is 2-size+1
  1060. * param dynRatio image is divided by dynRatio before histogram processing
  1061. */
  1062. public static void oilPainting(Mat src, Mat dst, int size, int dynRatio)
  1063. {
  1064. if (src != null) src.ThrowIfDisposed();
  1065. if (dst != null) dst.ThrowIfDisposed();
  1066. xphoto_Xphoto_oilPainting_11(src.nativeObj, dst.nativeObj, size, dynRatio);
  1067. }
  1068. //
  1069. // C++: Ptr_TonemapDurand cv::xphoto::createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_color = 2.0f, float sigma_space = 2.0f)
  1070. //
  1071. /**
  1072. * Creates TonemapDurand object
  1073. *
  1074. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1075. *
  1076. * param gamma gamma value for gamma correction. See createTonemap
  1077. * param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
  1078. * are maximum and minimum luminance values of the resulting image.
  1079. * param saturation saturation enhancement value. See createTonemapDrago
  1080. * param sigma_color bilateral filter sigma in color space
  1081. * param sigma_space bilateral filter sigma in coordinate space
  1082. * return automatically generated
  1083. */
  1084. public static TonemapDurand createTonemapDurand(float gamma, float contrast, float saturation, float sigma_color, float sigma_space)
  1085. {
  1086. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_10(gamma, contrast, saturation, sigma_color, sigma_space)));
  1087. }
  1088. /**
  1089. * Creates TonemapDurand object
  1090. *
  1091. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1092. *
  1093. * param gamma gamma value for gamma correction. See createTonemap
  1094. * param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
  1095. * are maximum and minimum luminance values of the resulting image.
  1096. * param saturation saturation enhancement value. See createTonemapDrago
  1097. * param sigma_color bilateral filter sigma in color space
  1098. * return automatically generated
  1099. */
  1100. public static TonemapDurand createTonemapDurand(float gamma, float contrast, float saturation, float sigma_color)
  1101. {
  1102. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_11(gamma, contrast, saturation, sigma_color)));
  1103. }
  1104. /**
  1105. * Creates TonemapDurand object
  1106. *
  1107. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1108. *
  1109. * param gamma gamma value for gamma correction. See createTonemap
  1110. * param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
  1111. * are maximum and minimum luminance values of the resulting image.
  1112. * param saturation saturation enhancement value. See createTonemapDrago
  1113. * return automatically generated
  1114. */
  1115. public static TonemapDurand createTonemapDurand(float gamma, float contrast, float saturation)
  1116. {
  1117. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_12(gamma, contrast, saturation)));
  1118. }
  1119. /**
  1120. * Creates TonemapDurand object
  1121. *
  1122. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1123. *
  1124. * param gamma gamma value for gamma correction. See createTonemap
  1125. * param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
  1126. * are maximum and minimum luminance values of the resulting image.
  1127. * return automatically generated
  1128. */
  1129. public static TonemapDurand createTonemapDurand(float gamma, float contrast)
  1130. {
  1131. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_13(gamma, contrast)));
  1132. }
  1133. /**
  1134. * Creates TonemapDurand object
  1135. *
  1136. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1137. *
  1138. * param gamma gamma value for gamma correction. See createTonemap
  1139. * are maximum and minimum luminance values of the resulting image.
  1140. * return automatically generated
  1141. */
  1142. public static TonemapDurand createTonemapDurand(float gamma)
  1143. {
  1144. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_14(gamma)));
  1145. }
  1146. /**
  1147. * Creates TonemapDurand object
  1148. *
  1149. * You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.
  1150. *
  1151. * are maximum and minimum luminance values of the resulting image.
  1152. * return automatically generated
  1153. */
  1154. public static TonemapDurand createTonemapDurand()
  1155. {
  1156. return TonemapDurand.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createTonemapDurand_15()));
  1157. }
  1158. //
  1159. // C++: Ptr_SimpleWB cv::xphoto::createSimpleWB()
  1160. //
  1161. /**
  1162. * Creates an instance of SimpleWB
  1163. * return automatically generated
  1164. */
  1165. public static SimpleWB createSimpleWB()
  1166. {
  1167. return SimpleWB.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createSimpleWB_10()));
  1168. }
  1169. //
  1170. // C++: Ptr_GrayworldWB cv::xphoto::createGrayworldWB()
  1171. //
  1172. /**
  1173. * Creates an instance of GrayworldWB
  1174. * return automatically generated
  1175. */
  1176. public static GrayworldWB createGrayworldWB()
  1177. {
  1178. return GrayworldWB.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createGrayworldWB_10()));
  1179. }
  1180. //
  1181. // C++: Ptr_LearningBasedWB cv::xphoto::createLearningBasedWB(String path_to_model = String())
  1182. //
  1183. /**
  1184. * Creates an instance of LearningBasedWB
  1185. *
  1186. * param path_to_model Path to a .yml file with the model. If not specified, the default model is used
  1187. * return automatically generated
  1188. */
  1189. public static LearningBasedWB createLearningBasedWB(string path_to_model)
  1190. {
  1191. return LearningBasedWB.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createLearningBasedWB_10(path_to_model)));
  1192. }
  1193. /**
  1194. * Creates an instance of LearningBasedWB
  1195. *
  1196. * return automatically generated
  1197. */
  1198. public static LearningBasedWB createLearningBasedWB()
  1199. {
  1200. return LearningBasedWB.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xphoto_Xphoto_createLearningBasedWB_11()));
  1201. }
  1202. //
  1203. // C++: void cv::xphoto::applyChannelGains(Mat src, Mat& dst, float gainB, float gainG, float gainR)
  1204. //
  1205. /**
  1206. * Implements an efficient fixed-point approximation for applying channel gains, which is
  1207. * the last step of multiple white balance algorithms.
  1208. *
  1209. * param src Input three-channel image in the BGR color space (either CV_8UC3 or CV_16UC3)
  1210. * param dst Output image of the same size and type as src.
  1211. * param gainB gain for the B channel
  1212. * param gainG gain for the G channel
  1213. * param gainR gain for the R channel
  1214. */
  1215. public static void applyChannelGains(Mat src, Mat dst, float gainB, float gainG, float gainR)
  1216. {
  1217. if (src != null) src.ThrowIfDisposed();
  1218. if (dst != null) dst.ThrowIfDisposed();
  1219. xphoto_Xphoto_applyChannelGains_10(src.nativeObj, dst.nativeObj, gainB, gainG, gainR);
  1220. }
  1221. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  1222. const string LIBNAME = "__Internal";
  1223. #else
  1224. const string LIBNAME = "opencvforunity";
  1225. #endif
  1226. // C++: void cv::xphoto::bm3dDenoising(Mat src, Mat& dstStep1, Mat& dstStep2, float h = 1, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2.0f, int normType = cv::NORM_L2, int step = cv::xphoto::BM3D_STEPALL, int transformType = cv::xphoto::HAAR)
  1227. [DllImport(LIBNAME)]
  1228. private static extern void xphoto_Xphoto_bm3dDenoising_10(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step, int transformType);
  1229. [DllImport(LIBNAME)]
  1230. private static extern void xphoto_Xphoto_bm3dDenoising_11(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step);
  1231. [DllImport(LIBNAME)]
  1232. private static extern void xphoto_Xphoto_bm3dDenoising_12(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType);
  1233. [DllImport(LIBNAME)]
  1234. private static extern void xphoto_Xphoto_bm3dDenoising_13(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta);
  1235. [DllImport(LIBNAME)]
  1236. private static extern void xphoto_Xphoto_bm3dDenoising_14(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep);
  1237. [DllImport(LIBNAME)]
  1238. private static extern void xphoto_Xphoto_bm3dDenoising_15(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize);
  1239. [DllImport(LIBNAME)]
  1240. private static extern void xphoto_Xphoto_bm3dDenoising_16(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2);
  1241. [DllImport(LIBNAME)]
  1242. private static extern void xphoto_Xphoto_bm3dDenoising_17(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1);
  1243. [DllImport(LIBNAME)]
  1244. private static extern void xphoto_Xphoto_bm3dDenoising_18(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize, int searchWindowSize);
  1245. [DllImport(LIBNAME)]
  1246. private static extern void xphoto_Xphoto_bm3dDenoising_19(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h, int templateWindowSize);
  1247. [DllImport(LIBNAME)]
  1248. private static extern void xphoto_Xphoto_bm3dDenoising_110(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj, float h);
  1249. [DllImport(LIBNAME)]
  1250. private static extern void xphoto_Xphoto_bm3dDenoising_111(IntPtr src_nativeObj, IntPtr dstStep1_nativeObj, IntPtr dstStep2_nativeObj);
  1251. // C++: void cv::xphoto::bm3dDenoising(Mat src, Mat& dst, float h = 1, int templateWindowSize = 4, int searchWindowSize = 16, int blockMatchingStep1 = 2500, int blockMatchingStep2 = 400, int groupSize = 8, int slidingStep = 1, float beta = 2.0f, int normType = cv::NORM_L2, int step = cv::xphoto::BM3D_STEPALL, int transformType = cv::xphoto::HAAR)
  1252. [DllImport(LIBNAME)]
  1253. private static extern void xphoto_Xphoto_bm3dDenoising_112(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step, int transformType);
  1254. [DllImport(LIBNAME)]
  1255. private static extern void xphoto_Xphoto_bm3dDenoising_113(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType, int step);
  1256. [DllImport(LIBNAME)]
  1257. private static extern void xphoto_Xphoto_bm3dDenoising_114(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta, int normType);
  1258. [DllImport(LIBNAME)]
  1259. private static extern void xphoto_Xphoto_bm3dDenoising_115(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep, float beta);
  1260. [DllImport(LIBNAME)]
  1261. private static extern void xphoto_Xphoto_bm3dDenoising_116(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize, int slidingStep);
  1262. [DllImport(LIBNAME)]
  1263. private static extern void xphoto_Xphoto_bm3dDenoising_117(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2, int groupSize);
  1264. [DllImport(LIBNAME)]
  1265. private static extern void xphoto_Xphoto_bm3dDenoising_118(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1, int blockMatchingStep2);
  1266. [DllImport(LIBNAME)]
  1267. private static extern void xphoto_Xphoto_bm3dDenoising_119(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize, int blockMatchingStep1);
  1268. [DllImport(LIBNAME)]
  1269. private static extern void xphoto_Xphoto_bm3dDenoising_120(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize, int searchWindowSize);
  1270. [DllImport(LIBNAME)]
  1271. private static extern void xphoto_Xphoto_bm3dDenoising_121(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h, int templateWindowSize);
  1272. [DllImport(LIBNAME)]
  1273. private static extern void xphoto_Xphoto_bm3dDenoising_122(IntPtr src_nativeObj, IntPtr dst_nativeObj, float h);
  1274. [DllImport(LIBNAME)]
  1275. private static extern void xphoto_Xphoto_bm3dDenoising_123(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  1276. // C++: void cv::xphoto::dctDenoising(Mat src, Mat dst, double sigma, int psize = 16)
  1277. [DllImport(LIBNAME)]
  1278. private static extern void xphoto_Xphoto_dctDenoising_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double sigma, int psize);
  1279. [DllImport(LIBNAME)]
  1280. private static extern void xphoto_Xphoto_dctDenoising_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double sigma);
  1281. // C++: void cv::xphoto::inpaint(Mat src, Mat mask, Mat dst, int algorithmType)
  1282. [DllImport(LIBNAME)]
  1283. private static extern void xphoto_Xphoto_inpaint_10(IntPtr src_nativeObj, IntPtr mask_nativeObj, IntPtr dst_nativeObj, int algorithmType);
  1284. // C++: void cv::xphoto::oilPainting(Mat src, Mat& dst, int size, int dynRatio, int code)
  1285. [DllImport(LIBNAME)]
  1286. private static extern void xphoto_Xphoto_oilPainting_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int size, int dynRatio, int code);
  1287. // C++: void cv::xphoto::oilPainting(Mat src, Mat& dst, int size, int dynRatio)
  1288. [DllImport(LIBNAME)]
  1289. private static extern void xphoto_Xphoto_oilPainting_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int size, int dynRatio);
  1290. // C++: Ptr_TonemapDurand cv::xphoto::createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_color = 2.0f, float sigma_space = 2.0f)
  1291. [DllImport(LIBNAME)]
  1292. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_10(float gamma, float contrast, float saturation, float sigma_color, float sigma_space);
  1293. [DllImport(LIBNAME)]
  1294. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_11(float gamma, float contrast, float saturation, float sigma_color);
  1295. [DllImport(LIBNAME)]
  1296. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_12(float gamma, float contrast, float saturation);
  1297. [DllImport(LIBNAME)]
  1298. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_13(float gamma, float contrast);
  1299. [DllImport(LIBNAME)]
  1300. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_14(float gamma);
  1301. [DllImport(LIBNAME)]
  1302. private static extern IntPtr xphoto_Xphoto_createTonemapDurand_15();
  1303. // C++: Ptr_SimpleWB cv::xphoto::createSimpleWB()
  1304. [DllImport(LIBNAME)]
  1305. private static extern IntPtr xphoto_Xphoto_createSimpleWB_10();
  1306. // C++: Ptr_GrayworldWB cv::xphoto::createGrayworldWB()
  1307. [DllImport(LIBNAME)]
  1308. private static extern IntPtr xphoto_Xphoto_createGrayworldWB_10();
  1309. // C++: Ptr_LearningBasedWB cv::xphoto::createLearningBasedWB(String path_to_model = String())
  1310. [DllImport(LIBNAME)]
  1311. private static extern IntPtr xphoto_Xphoto_createLearningBasedWB_10(string path_to_model);
  1312. [DllImport(LIBNAME)]
  1313. private static extern IntPtr xphoto_Xphoto_createLearningBasedWB_11();
  1314. // C++: void cv::xphoto::applyChannelGains(Mat src, Mat& dst, float gainB, float gainG, float gainR)
  1315. [DllImport(LIBNAME)]
  1316. private static extern void xphoto_Xphoto_applyChannelGains_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, float gainB, float gainG, float gainR);
  1317. }
  1318. }