얼마전 테스트 해본 계산 알고리즘은 BM(block match)인데 먼가 먼 곳은 전혀 안 잡아줘서
어떻게 설정을 해야 하나 패러미터를 찾아보고 있었는데 다른 알고리즘이 있다는걸 발견함.
numDisparities는 검색할 범위. 16의 배수로 하라는데, 해보면 화면의 왼쪽이 사라진다. 지정된 숫자만큼 가장 왼쪽은 버려지는 듯
blockSize. 동일한 블록으로 연산할 단위라고 해야하나. 해당 숫자가 NxN으로 되는건지 숫자가 커지면 블럭이 거칠어 지는 느낌.
numDisparities the disparity search range. For each pixel algorithm will find the best disparity from 0 (default minimum disparity) to numDisparities. The search range can then be shifted by changing the minimum disparity. blockSize the linear size of the blocks compared by the algorithm. The size should be odd (as the block is centered at the current pixel). Larger block size implies smoother, though less accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher chance for algorithm to find a wrong correspondence. |
[링크 : https://docs.opencv.org/4.x/d9/dba/classcv_1_1StereoBM.html]
[링크 : https://makepluscode.tistory.com/108]
BM 방법은 실내에서나 쓰는거지 실외에서는 잘 안 맞다고 그러니 SGM 기반으로 된 걸 써라~ 인가.
Wrong method. BM is only meant for simple indoor use with low dynamic measuring range. With indoor image, you just need a adjsut mindisp and number of disp and window size. For outdoor, it is more complex. Maybe u just start. BM and other global based method has the poor result. Either disfigured for overfitting, or streaking effect due to local similarity error. Current state of the art for traditional CV is the SGM based method proposed by HH. And for the deep learning-based method, there is no best case, vary from case to case/dataset to dataset. The work from lecun Žbontar "Stereo Matching by Training a Convolutional Neural Network " is sth that I used for comparison often. |
[링크 : https://stackoverflow.com/questions/62461799/]
별별 희한한 알고리즘이 나온다. SGBM? BM 이 붙긴한데..
alg = strcmp(_alg, "bm") == 0 ? STEREO_BM : strcmp(_alg, "sgbm") == 0 ? STEREO_SGBM : strcmp(_alg, "hh") == 0 ? STEREO_HH : strcmp(_alg, "var") == 0 ? STEREO_VAR : -1; |
[링크 : https://copyprogramming.com/howto/opencv-stereo-matching]
[링크 : https://docs.opencv.org/4.9.0/d9/dba/classcv_1_1StereoBM.html]
[링크 : https://docs.opencv.org/4.9.0/d2/d85/classcv_1_1StereoSGBM.html]
SGBM
semi-global block matching algorithm |
[링크 : https://amroamroamro.github.io/mexopencv/matlab/cv.StereoSGBM.html]
+
2024.02.26
요 근래 버전이긴 한데 오래된 버전에서도 나오긴 하고 python엣도 SGBM이 있으니, 테스트는 해봐야 할 듯.
>>> import cv2>>> cv2.stereo cv2.stereo cv2.stereoRectifyUncalibrated( cv2.stereoCalibrate( cv2.stereo_MatchQuasiDense( cv2.stereoCalibrateExtended( cv2.stereo_PropagationParameters( cv2.stereoRectify( cv2.stereo_QuasiDenseStereo( >>> cv2.St cv2.StereoBM( cv2.StereoBM_PREFILTER_NORMALIZED_RESPONSE cv2.StereoBM_PREFILTER_XSOBEL cv2.StereoBM_create( cv2.StereoMatcher( cv2.StereoMatcher_DISP_SCALE cv2.StereoMatcher_DISP_SHIFT cv2.StereoSGBM( cv2.StereoSGBM_MODE_HH cv2.StereoSGBM_MODE_HH4 cv2.StereoSGBM_MODE_SGBM cv2.StereoSGBM_MODE_SGBM_3WAY cv2.StereoSGBM_create( cv2.Stitcher( cv2.Stitcher_ERR_CAMERA_PARAMS_ADJUST_FAIL cv2.Stitcher_ERR_HOMOGRAPHY_EST_FAIL cv2.Stitcher_ERR_NEED_MORE_IMGS cv2.Stitcher_OK cv2.Stitcher_PANORAMA cv2.Stitcher_SCANS cv2.Stitcher_create( |
In block matching or cv2.StereoBM_create() the disparity is computed by comparing the sum of absolute differences (SAD) of each 'block' of pixels. In semi-global block matching or cv2.StereoSGBM_create() forces similar disparity on neighbouring blocks. This creates a more complete disparity map but is more computationally expensive.
Paper that discusses 'block matching' Paper that discusses 'semi-global block matching' |
'Programming > openCV' 카테고리의 다른 글
openCV stereo SGBM WLS 필터 (0) | 2024.02.26 |
---|---|
openCV stereo SBGM 예제, depth map을 imshow로 보기 (0) | 2024.02.26 |
opencv 스테레오 카메라 깊이 처리하기 (0) | 2024.02.21 |
opencv 스테레오 사진 깊이 분석 전처리 - 렌즈 왜곡 보정 (0) | 2024.02.20 |
opencv 카메라 캡쳐 - 최신 이미지 갱신 (0) | 2024.01.25 |