001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.calib3d; 005 006import org.opencv.calib3d.StereoMatcher; 007import org.opencv.calib3d.StereoSGBM; 008 009// C++: class StereoSGBM 010/** 011 * The class implements the modified H. Hirschmuller algorithm CITE: HH08 that differs from the original 012 * one as follows: 013 * 014 * <ul> 015 * <li> 016 * By default, the algorithm is single-pass, which means that you consider only 5 directions 017 * instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the 018 * algorithm but beware that it may consume a lot of memory. 019 * </li> 020 * <li> 021 * The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the 022 * blocks to single pixels. 023 * </li> 024 * <li> 025 * Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi 026 * sub-pixel metric from CITE: BT98 is used. Though, the color images are supported as well. 027 * </li> 028 * <li> 029 * Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for 030 * example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness 031 * check, quadratic interpolation and speckle filtering). 032 * </li> 033 * </ul> 034 * 035 * <b>Note:</b> 036 * <ul> 037 * <li> 038 * (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found 039 * at opencv_source_code/samples/python/stereo_match.py 040 * </li> 041 * </ul> 042 */ 043public class StereoSGBM extends StereoMatcher { 044 045 protected StereoSGBM(long addr) { super(addr); } 046 047 // internal usage only 048 public static StereoSGBM __fromPtr__(long addr) { return new StereoSGBM(addr); } 049 050 // C++: enum <unnamed> 051 public static final int 052 MODE_SGBM = 0, 053 MODE_HH = 1, 054 MODE_SGBM_3WAY = 2, 055 MODE_HH4 = 3; 056 057 058 // 059 // C++: int cv::StereoSGBM::getPreFilterCap() 060 // 061 062 public int getPreFilterCap() { 063 return getPreFilterCap_0(nativeObj); 064 } 065 066 067 // 068 // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap) 069 // 070 071 public void setPreFilterCap(int preFilterCap) { 072 setPreFilterCap_0(nativeObj, preFilterCap); 073 } 074 075 076 // 077 // C++: int cv::StereoSGBM::getUniquenessRatio() 078 // 079 080 public int getUniquenessRatio() { 081 return getUniquenessRatio_0(nativeObj); 082 } 083 084 085 // 086 // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio) 087 // 088 089 public void setUniquenessRatio(int uniquenessRatio) { 090 setUniquenessRatio_0(nativeObj, uniquenessRatio); 091 } 092 093 094 // 095 // C++: int cv::StereoSGBM::getP1() 096 // 097 098 public int getP1() { 099 return getP1_0(nativeObj); 100 } 101 102 103 // 104 // C++: void cv::StereoSGBM::setP1(int P1) 105 // 106 107 public void setP1(int P1) { 108 setP1_0(nativeObj, P1); 109 } 110 111 112 // 113 // C++: int cv::StereoSGBM::getP2() 114 // 115 116 public int getP2() { 117 return getP2_0(nativeObj); 118 } 119 120 121 // 122 // C++: void cv::StereoSGBM::setP2(int P2) 123 // 124 125 public void setP2(int P2) { 126 setP2_0(nativeObj, P2); 127 } 128 129 130 // 131 // C++: int cv::StereoSGBM::getMode() 132 // 133 134 public int getMode() { 135 return getMode_0(nativeObj); 136 } 137 138 139 // 140 // C++: void cv::StereoSGBM::setMode(int mode) 141 // 142 143 public void setMode(int mode) { 144 setMode_0(nativeObj, mode); 145 } 146 147 148 // 149 // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM) 150 // 151 152 /** 153 * Creates StereoSGBM object 154 * 155 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 156 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 157 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 158 * zero. In the current implementation, this parameter must be divisible by 16. 159 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 160 * somewhere in the 3..11 range. 161 * @param P1 The first parameter controlling the disparity smoothness. See below. 162 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 163 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 164 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 165 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 166 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 167 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 168 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 169 * disparity check. Set it to a non-positive value to disable the check. 170 * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first 171 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 172 * The result values are passed to the Birchfield-Tomasi pixel cost function. 173 * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function 174 * value should "win" the second best value to consider the found match correct. Normally, a value 175 * within the 5-15 range is good enough. 176 * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles 177 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 178 * 50-200 range. 179 * @param speckleRange Maximum disparity variation within each connected component. If you do speckle 180 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 181 * Normally, 1 or 2 is good enough. 182 * @param mode Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming 183 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 184 * huge for HD-size pictures. By default, it is set to false . 185 * 186 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 187 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 188 * to a custom value. 189 * @return automatically generated 190 */ 191 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode) { 192 return StereoSGBM.__fromPtr__(create_0(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode)); 193 } 194 195 /** 196 * Creates StereoSGBM object 197 * 198 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 199 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 200 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 201 * zero. In the current implementation, this parameter must be divisible by 16. 202 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 203 * somewhere in the 3..11 range. 204 * @param P1 The first parameter controlling the disparity smoothness. See below. 205 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 206 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 207 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 208 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 209 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 210 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 211 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 212 * disparity check. Set it to a non-positive value to disable the check. 213 * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first 214 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 215 * The result values are passed to the Birchfield-Tomasi pixel cost function. 216 * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function 217 * value should "win" the second best value to consider the found match correct. Normally, a value 218 * within the 5-15 range is good enough. 219 * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles 220 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 221 * 50-200 range. 222 * @param speckleRange Maximum disparity variation within each connected component. If you do speckle 223 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 224 * Normally, 1 or 2 is good enough. 225 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 226 * huge for HD-size pictures. By default, it is set to false . 227 * 228 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 229 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 230 * to a custom value. 231 * @return automatically generated 232 */ 233 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange) { 234 return StereoSGBM.__fromPtr__(create_1(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange)); 235 } 236 237 /** 238 * Creates StereoSGBM object 239 * 240 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 241 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 242 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 243 * zero. In the current implementation, this parameter must be divisible by 16. 244 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 245 * somewhere in the 3..11 range. 246 * @param P1 The first parameter controlling the disparity smoothness. See below. 247 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 248 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 249 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 250 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 251 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 252 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 253 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 254 * disparity check. Set it to a non-positive value to disable the check. 255 * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first 256 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 257 * The result values are passed to the Birchfield-Tomasi pixel cost function. 258 * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function 259 * value should "win" the second best value to consider the found match correct. Normally, a value 260 * within the 5-15 range is good enough. 261 * @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles 262 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 263 * 50-200 range. 264 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 265 * Normally, 1 or 2 is good enough. 266 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 267 * huge for HD-size pictures. By default, it is set to false . 268 * 269 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 270 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 271 * to a custom value. 272 * @return automatically generated 273 */ 274 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize) { 275 return StereoSGBM.__fromPtr__(create_2(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize)); 276 } 277 278 /** 279 * Creates StereoSGBM object 280 * 281 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 282 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 283 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 284 * zero. In the current implementation, this parameter must be divisible by 16. 285 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 286 * somewhere in the 3..11 range. 287 * @param P1 The first parameter controlling the disparity smoothness. See below. 288 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 289 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 290 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 291 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 292 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 293 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 294 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 295 * disparity check. Set it to a non-positive value to disable the check. 296 * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first 297 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 298 * The result values are passed to the Birchfield-Tomasi pixel cost function. 299 * @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function 300 * value should "win" the second best value to consider the found match correct. Normally, a value 301 * within the 5-15 range is good enough. 302 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 303 * 50-200 range. 304 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 305 * Normally, 1 or 2 is good enough. 306 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 307 * huge for HD-size pictures. By default, it is set to false . 308 * 309 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 310 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 311 * to a custom value. 312 * @return automatically generated 313 */ 314 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio) { 315 return StereoSGBM.__fromPtr__(create_3(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio)); 316 } 317 318 /** 319 * Creates StereoSGBM object 320 * 321 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 322 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 323 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 324 * zero. In the current implementation, this parameter must be divisible by 16. 325 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 326 * somewhere in the 3..11 range. 327 * @param P1 The first parameter controlling the disparity smoothness. See below. 328 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 329 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 330 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 331 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 332 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 333 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 334 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 335 * disparity check. Set it to a non-positive value to disable the check. 336 * @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first 337 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 338 * The result values are passed to the Birchfield-Tomasi pixel cost function. 339 * value should "win" the second best value to consider the found match correct. Normally, a value 340 * within the 5-15 range is good enough. 341 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 342 * 50-200 range. 343 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 344 * Normally, 1 or 2 is good enough. 345 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 346 * huge for HD-size pictures. By default, it is set to false . 347 * 348 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 349 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 350 * to a custom value. 351 * @return automatically generated 352 */ 353 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap) { 354 return StereoSGBM.__fromPtr__(create_4(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap)); 355 } 356 357 /** 358 * Creates StereoSGBM object 359 * 360 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 361 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 362 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 363 * zero. In the current implementation, this parameter must be divisible by 16. 364 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 365 * somewhere in the 3..11 range. 366 * @param P1 The first parameter controlling the disparity smoothness. See below. 367 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 368 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 369 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 370 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 371 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 372 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 373 * @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right 374 * disparity check. Set it to a non-positive value to disable the check. 375 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 376 * The result values are passed to the Birchfield-Tomasi pixel cost function. 377 * value should "win" the second best value to consider the found match correct. Normally, a value 378 * within the 5-15 range is good enough. 379 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 380 * 50-200 range. 381 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 382 * Normally, 1 or 2 is good enough. 383 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 384 * huge for HD-size pictures. By default, it is set to false . 385 * 386 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 387 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 388 * to a custom value. 389 * @return automatically generated 390 */ 391 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff) { 392 return StereoSGBM.__fromPtr__(create_5(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff)); 393 } 394 395 /** 396 * Creates StereoSGBM object 397 * 398 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 399 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 400 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 401 * zero. In the current implementation, this parameter must be divisible by 16. 402 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 403 * somewhere in the 3..11 range. 404 * @param P1 The first parameter controlling the disparity smoothness. See below. 405 * @param P2 The second parameter controlling the disparity smoothness. The larger the values are, 406 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 407 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 408 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 409 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 410 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 411 * disparity check. Set it to a non-positive value to disable the check. 412 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 413 * The result values are passed to the Birchfield-Tomasi pixel cost function. 414 * value should "win" the second best value to consider the found match correct. Normally, a value 415 * within the 5-15 range is good enough. 416 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 417 * 50-200 range. 418 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 419 * Normally, 1 or 2 is good enough. 420 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 421 * huge for HD-size pictures. By default, it is set to false . 422 * 423 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 424 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 425 * to a custom value. 426 * @return automatically generated 427 */ 428 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2) { 429 return StereoSGBM.__fromPtr__(create_6(minDisparity, numDisparities, blockSize, P1, P2)); 430 } 431 432 /** 433 * Creates StereoSGBM object 434 * 435 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 436 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 437 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 438 * zero. In the current implementation, this parameter must be divisible by 16. 439 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 440 * somewhere in the 3..11 range. 441 * @param P1 The first parameter controlling the disparity smoothness. See below. 442 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 443 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 444 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 445 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 446 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 447 * disparity check. Set it to a non-positive value to disable the check. 448 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 449 * The result values are passed to the Birchfield-Tomasi pixel cost function. 450 * value should "win" the second best value to consider the found match correct. Normally, a value 451 * within the 5-15 range is good enough. 452 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 453 * 50-200 range. 454 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 455 * Normally, 1 or 2 is good enough. 456 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 457 * huge for HD-size pictures. By default, it is set to false . 458 * 459 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 460 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 461 * to a custom value. 462 * @return automatically generated 463 */ 464 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1) { 465 return StereoSGBM.__fromPtr__(create_7(minDisparity, numDisparities, blockSize, P1)); 466 } 467 468 /** 469 * Creates StereoSGBM object 470 * 471 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 472 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 473 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 474 * zero. In the current implementation, this parameter must be divisible by 16. 475 * @param blockSize Matched block size. It must be an odd number >=1 . Normally, it should be 476 * somewhere in the 3..11 range. 477 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 478 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 479 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 480 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 481 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 482 * disparity check. Set it to a non-positive value to disable the check. 483 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 484 * The result values are passed to the Birchfield-Tomasi pixel cost function. 485 * value should "win" the second best value to consider the found match correct. Normally, a value 486 * within the 5-15 range is good enough. 487 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 488 * 50-200 range. 489 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 490 * Normally, 1 or 2 is good enough. 491 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 492 * huge for HD-size pictures. By default, it is set to false . 493 * 494 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 495 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 496 * to a custom value. 497 * @return automatically generated 498 */ 499 public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize) { 500 return StereoSGBM.__fromPtr__(create_8(minDisparity, numDisparities, blockSize)); 501 } 502 503 /** 504 * Creates StereoSGBM object 505 * 506 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 507 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 508 * @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than 509 * zero. In the current implementation, this parameter must be divisible by 16. 510 * somewhere in the 3..11 range. 511 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 512 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 513 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 514 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 515 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 516 * disparity check. Set it to a non-positive value to disable the check. 517 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 518 * The result values are passed to the Birchfield-Tomasi pixel cost function. 519 * value should "win" the second best value to consider the found match correct. Normally, a value 520 * within the 5-15 range is good enough. 521 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 522 * 50-200 range. 523 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 524 * Normally, 1 or 2 is good enough. 525 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 526 * huge for HD-size pictures. By default, it is set to false . 527 * 528 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 529 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 530 * to a custom value. 531 * @return automatically generated 532 */ 533 public static StereoSGBM create(int minDisparity, int numDisparities) { 534 return StereoSGBM.__fromPtr__(create_9(minDisparity, numDisparities)); 535 } 536 537 /** 538 * Creates StereoSGBM object 539 * 540 * @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes 541 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 542 * zero. In the current implementation, this parameter must be divisible by 16. 543 * somewhere in the 3..11 range. 544 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 545 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 546 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 547 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 548 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 549 * disparity check. Set it to a non-positive value to disable the check. 550 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 551 * The result values are passed to the Birchfield-Tomasi pixel cost function. 552 * value should "win" the second best value to consider the found match correct. Normally, a value 553 * within the 5-15 range is good enough. 554 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 555 * 50-200 range. 556 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 557 * Normally, 1 or 2 is good enough. 558 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 559 * huge for HD-size pictures. By default, it is set to false . 560 * 561 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 562 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 563 * to a custom value. 564 * @return automatically generated 565 */ 566 public static StereoSGBM create(int minDisparity) { 567 return StereoSGBM.__fromPtr__(create_10(minDisparity)); 568 } 569 570 /** 571 * Creates StereoSGBM object 572 * 573 * rectification algorithms can shift images, so this parameter needs to be adjusted accordingly. 574 * zero. In the current implementation, this parameter must be divisible by 16. 575 * somewhere in the 3..11 range. 576 * the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 577 * between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor 578 * pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good 579 * P1 and P2 values are shown (like 8\*number_of_image_channels\*blockSize\*blockSize and 580 * 32\*number_of_image_channels\*blockSize\*blockSize , respectively). 581 * disparity check. Set it to a non-positive value to disable the check. 582 * computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. 583 * The result values are passed to the Birchfield-Tomasi pixel cost function. 584 * value should "win" the second best value to consider the found match correct. Normally, a value 585 * within the 5-15 range is good enough. 586 * and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 587 * 50-200 range. 588 * filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. 589 * Normally, 1 or 2 is good enough. 590 * algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and 591 * huge for HD-size pictures. By default, it is set to false . 592 * 593 * The first constructor initializes StereoSGBM with all the default parameters. So, you only have to 594 * set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter 595 * to a custom value. 596 * @return automatically generated 597 */ 598 public static StereoSGBM create() { 599 return StereoSGBM.__fromPtr__(create_11()); 600 } 601 602 603 @Override 604 protected void finalize() throws Throwable { 605 delete(nativeObj); 606 } 607 608 609 610 // C++: int cv::StereoSGBM::getPreFilterCap() 611 private static native int getPreFilterCap_0(long nativeObj); 612 613 // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap) 614 private static native void setPreFilterCap_0(long nativeObj, int preFilterCap); 615 616 // C++: int cv::StereoSGBM::getUniquenessRatio() 617 private static native int getUniquenessRatio_0(long nativeObj); 618 619 // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio) 620 private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio); 621 622 // C++: int cv::StereoSGBM::getP1() 623 private static native int getP1_0(long nativeObj); 624 625 // C++: void cv::StereoSGBM::setP1(int P1) 626 private static native void setP1_0(long nativeObj, int P1); 627 628 // C++: int cv::StereoSGBM::getP2() 629 private static native int getP2_0(long nativeObj); 630 631 // C++: void cv::StereoSGBM::setP2(int P2) 632 private static native void setP2_0(long nativeObj, int P2); 633 634 // C++: int cv::StereoSGBM::getMode() 635 private static native int getMode_0(long nativeObj); 636 637 // C++: void cv::StereoSGBM::setMode(int mode) 638 private static native void setMode_0(long nativeObj, int mode); 639 640 // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM) 641 private static native long create_0(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode); 642 private static native long create_1(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange); 643 private static native long create_2(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize); 644 private static native long create_3(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio); 645 private static native long create_4(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap); 646 private static native long create_5(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff); 647 private static native long create_6(int minDisparity, int numDisparities, int blockSize, int P1, int P2); 648 private static native long create_7(int minDisparity, int numDisparities, int blockSize, int P1); 649 private static native long create_8(int minDisparity, int numDisparities, int blockSize); 650 private static native long create_9(int minDisparity, int numDisparities); 651 private static native long create_10(int minDisparity); 652 private static native long create_11(); 653 654 // native support for java finalize() 655 private static native void delete(long nativeObj); 656 657}