⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stcoptdp.cpp

📁 这是一个用于立体匹配的程序。 可以用来进行立体匹配!
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////////
//
// NAME
//  StcOptDP.cpp -- select the best matches using dynamic programming
//
// DESCRIPTION
//  Input:  m_cost:      DSI (disparity space image)
//  Output: m_disparity  best disparities in range [0 .. n_disp]
//
//  Dynamic programming 1: like Intille & Bobick, no ground control points, but
//  encourage disparity discontinuities along intensity edges
//
//    Each cell in x-d slice has one of three states:
//      0: M - matched
//      1: L - only visible in left image
//      2: R - only visible in right image
//
//    Here is a sample path through a DSI that uses the left image as reference:
//
//    d=3    ' ' ' ' ' ' ' ' M M M ' ' ' ' ' ' 
//    d=2    ' ' ' ' ' M M L ' ' R M M ' ' ' ' 
//    d=1    ' ' ' ' L ' ' ' ' ' ' ' R ' ' ' ' 
//    d=0    M M M L ' ' ' ' ' ' ' ' R M M M M
//
//         x=0 1 2 3 4 5 6 7 8  10  12  14  16
//    
//    The path is traversed from left to right.
//    It can be seen that there are seven possible transitions (current state is upper
//    case, predecessor is lower case):
//
//      0      1     2     3    4    5     6
//
//                    L     M   m    r
//                   /     /    |    |
//    m--M   m--L   l     l     R    R   r--M
//
//    At each cell, we keep three cost values that correspond to the cumulative cost along the 
//    lowest-cost path to the cell, ending in the current state.  These values are stored in
//    the 3-band image sumcost (indexed by d, x rather than x, y),
//    where we use bands 0, 1, 2 for state M, L, R.  The costs are 
//    accumulated by adding a value to the sumcost value of the predecessor cell:
//    M cells get charged the matching cost; L and R cells get charged occlusion costs
//    ocL, ocR.  In addition, for transitions 3 and 6, we charge the horizontal smoothness
//    cost to encourage disparity jumps to align with high intensity gradients.
//  
//
//    NOTE: This implementation makes explicit assumptions about matches "shadowing" other
//    matches, not only in the same DSI column, but also in the diagonal corresponding
//    to the match-frame's line of sight.  In particular, it is assumed that each 
//    d-level in the DSI represents a shift of one pixel to the right.  This is only true
//    if m_disp_step == 1.
//
//
// SEE ALSO
//  StereoMatcher.h
//  StereoMatcher.cpp
//
// Copyright 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -