Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions modules/ximgproc/src/structured_edge_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,11 @@ class StructuredEdgeDetectionImpl : public StructuredEdgeDetection
{// for j,k in [0;width)x[0;nTreesEval)

int currentNode = pIndex[j*nTreesEval + k];

int start = __rf.edgeBoundaries[currentNode];
int finish = __rf.edgeBoundaries[currentNode + 1];
size_t sizeBoundaries = __rf.edgeBoundaries.size();
int convertedBoundaries = static_cast<int>(sizeBoundaries);
int nBnds = (convertedBoundaries - 1) / (nTreesNodes * nTrees);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like nBnds is a constant for these loops (so it should be moved out).

Does "((convertedBoundaries - 1) % (nTreesNodes * nTrees)) == 0" always (remainder == 0)?
Or should we calculate original expression exactly (multiplication at first): currentNode * (convertedBoundaries - 1) / (nTreesNodes * nTrees)?

int start = __rf.edgeBoundaries[currentNode * nBnds];
int finish = __rf.edgeBoundaries[currentNode * nBnds + 1];

if (start == finish)
continue;
Expand Down