请你能帮我理解 Matlab 帮助中关于立体视觉 - 基本块匹配的代码吗?
% Scan over all rows.
for m=1:nRowsLeft
% Set min/max row bounds for image block.
minr = max(1,m-halfBlockSize);
maxr = min(nRowsLeft,m+halfBlockSize);
% Scan over all columns.
for n=1:size(leftI,2)
minc = max(1,n-halfBlockSize);
maxc = min(size(leftI,2),n+halfBlockSize);
% Compute disparity bounds.
mind = max( -disparityRange, 1-minc );
maxd = min( disparityRange, size(leftI,2)-maxc );
% Construct template and region of interest.
template = rightI(minr:maxr,minc:maxc);
templateCenter = floor((size(template)+1)/2);
roi = [minc+templateCenter(2)+mind-1 ...
minr+templateCenter(1)-1 ...
maxd-mind+1 1];
% Lookup proper TemplateMatcher object; create if empty.
if isempty(tmats{size(template,1),size(template,2)})
tmats{size(template,1),size(template,2)} = ...
vision.TemplateMatcher('ROIInputPort',true);
end
thisTemplateMatcher = tmats{size(template,1),size(template,2)};
% Run TemplateMatcher object.
loc = step(thisTemplateMatcher, leftI, template, roi);
Dbasic(m,n) = loc(1) - roi(1) + mind;
end
waitbar(m/nRowsLeft,hWaitBar);
end
根据Matlab帮助:loc包含左图像中点的位置坐标,roi包含[x y width height]
右图像中x和y是左上角坐标的区域的位置坐标。
我想知道左右图像中的对应坐标。对于左图:x = loc(1)
,y = loc(2)
对于右图:x = roi(1) - mind, y = loc(2)
这个对吗?我不确定 roi 里面到底是什么。