what is the function of... ?please explain the statement ' roi'. and ' isempty'
Show older comments
for m=1:size(leftI,1)
% Set min/max row bounds for image block.
minr = max(1,m-halfBlockSize);
maxr = min(size(leftI,1),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 = [minr+templateCenter(1)-2 ...
minc+templateCenter(2)+mind-2 ...
1 maxd-mind+1];
% Lookup proper TemplateMatcher object; create if empty.
if isempty(tmats{size(template,1),size(template,2)})
tmats{size(template,1),size(template,2)} = ...
video.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(2) - roi(2) + mind;
end
end
Accepted Answer
More Answers (1)
Image Analyst
on 1 Oct 2011
0 votes
isempty() basically checks to see if the variable has been assigned and has a value or not. roi means "region of interest" and is the portion of the array to operate on.
3 Comments
neenu jose
on 1 Oct 2011
Wayne King
on 1 Oct 2011
Hi Neenu, that is just the definition of the region of interest as ImageAnalyst has said. I suggest you place a breakpoint in that for loop and then use F10 to step through it, you will see how the region of interest changes and how the location of where the System object handle placement changes as well.
neenu jose
on 16 Oct 2011
Categories
Find more on MATLAB Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!