Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于pms_propagation.cpp里ViewPropagation的一个问题 #5

Open
lingkang opened this issue Dec 31, 2020 · 1 comment
Open

关于pms_propagation.cpp里ViewPropagation的一个问题 #5

lingkang opened this issue Dec 31, 2020 · 1 comment

Comments

@lingkang
Copy link

首先感谢大佬分享
在论文第5页 View Propagation中,作者提到: “We check all pixels of the second view that have our current pixel p as a
matching point according to their current plane”。
但是在代码实现中,好像是用当前点 p 的视差计算出了唯一的一个对应点 p'
是我理解有误还是,这一点不是特别重要 被省略掉了?
`void PMSPropagation::ViewPropagation(const sint32& x, const sint32& y) const
{
// --
// 视图传播
// 搜索p在右视图的同名点q,更新q的平面

// 左视图匹配点p的位置及其视差平面 
const sint32 p = y * width_ + x;
const auto& plane_p = plane_left_[p];
auto* cost_cpt = dynamic_cast<CostComputerPMS*>(cost_cpt_right_);

const float32 d_p = plane_p.to_disparity(x, y);

// 计算右视图列号
const sint32 xr = lround(x - d_p);
if (xr < 0 || xr >= width_) {
	return;
}

const sint32 q = y * width_ + xr;
auto& plane_q = plane_right_[q];
auto& cost_q = cost_right_[q];

// 将左视图的视差平面转换到右视图
const auto plane_p2q = plane_p.to_another_view(x, y);
const float32 d_q = plane_p2q.to_disparity(xr,y);
const auto cost = cost_cpt->ComputeA(xr, y, plane_p2q);
if (cost < cost_q) {
	plane_q = plane_p2q;
	cost_q = cost;
}

}`

@ethan-li-coding
Copy link
Owner

这样做是为了加快效率,原文说的是对左视图像素p,要在检查候选视差内的所有右视图对应像素的平面是否更合适,进而更新左视图p的视差平面,对一个像素p要遍历N次(N等于候选视差数量)。但如果反转一下思路,在这一步更新右视图像素q的视差平面,则只用遍历一次就行了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants