Skip to content

Commit

Permalink
minor change: line swap
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlim committed Jul 6, 2013
1 parent bd48151 commit cbcbd3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
8 changes: 1 addition & 7 deletions stEvalBsds.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,8 @@

I = imread([imgDir id '.jpg']);
st = max(min(1,stDetect(I,model)),0);
E = stToEdges(st,1); S=5;
E = stToEdges(st,1);

for s=1:S,
E([s end-s+1],:,:)=E([s end-s+1],:,:)*(s-1)/S;
end
for s=1:S,
E(:,[s end-s+1],:)=E(:,[s end-s+1],:)*(s-1)/S;
end
imwrite(uint8(E*255),[resDir id '.png']);
end

Expand Down
20 changes: 18 additions & 2 deletions stToEdges.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
function E = stToEdges( S, nms )
function E = stToEdges( S, nms, suppress )
% Convert sketch tokens to edges.
%
% USAGE
% E = stToEdges( S, [nms] )
% E = stToEdges( S, [nms], [suppress] )
%
% INPUTS
% S - [h x w x (nTokens+1)] sketch token probability maps
% nms - [1] if true apply non-maximum suppression to edges
% suppress - [1] if true suppress boundary confidence in order to
% compensate padding effect
%
% OUTPUTS
% E - [h x w] edge probability map
Expand All @@ -24,6 +26,9 @@
if(nargin<2 || isempty(nms)),
nms=1;
end
if(nargin<3 || isempty(suppress)),
suppress=1;
end

% extract edge probabilities
E = 1-S(:,:,end);
Expand All @@ -33,6 +38,17 @@
O=edgeOrient(E,4);
E=edgeNms(E,O,1);
end

% apply boundary suppression
if suppress
S=5;
for s=1:S,
E([s end-s+1],:,:)=E([s end-s+1],:,:)*(s-1)/S;
end
for s=1:S,
E(:,[s end-s+1],:)=E(:,[s end-s+1],:)*(s-1)/S;
end
end

end

Expand Down

0 comments on commit cbcbd3d

Please sign in to comment.