Skip to content
Open
Show file tree
Hide file tree
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: 6 additions & 2 deletions src/EdgeDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void EdgeDrawer::drawEdgeTreeStack(Pixel anchor, ImageEdge &initialPixels, bool

// The index in the pixels array of the last segment we have tried to add
uint8_t direction, gradDir, lineDirection;
int i, indexInArray, lastChekedPxIdx, initialPxIndex, indexInImage, nElements;
int i, indexInArray, lastChekedPxIdx, initialPxIndex, indexInImage, nElements, minSize;
bool addPixelsForTheFirstSide, inlierOverwritten, popStack, firstBranch, isAnchorFirstPx, wasExtended;
bool localSegInitialized, segment;
Pixel px, lastPx;
Expand Down Expand Up @@ -205,8 +205,12 @@ void EdgeDrawer::drawEdgeTreeStack(Pixel anchor, ImageEdge &initialPixels, bool
// Mark the pixel as edge only if it is an inlier
edgeImg[indexInArray] = UPM_ED_EDGE_PIXEL;

minSize = localSegInitialized
? localSegment->getLastPixelIndex() + 1 + UPM_SKIP_EDGE_PT
: lastChekedPxIdx + minLineLength;

// If there are enough pixels try to fit a segment to them
if (pixels.size() - lastChekedPxIdx >= minLineLength) {
if (pixels.size() >= minSize) {
//If we have already set the first minLineLength pixels, just add the new UPM_SKIP_EDGE_PT ones
if (localSegInitialized) {
localSegment->skipPositions();
Expand Down
3 changes: 3 additions & 0 deletions src/FullSegmentInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class FullSegmentInfo {
//Returns the Pixel in the first extreme of the segment
inline const Pixel &getLastPixel() const { return lastPx; }

//Returns the index for Pixel in the second extreme of the segment
inline const int getLastPixelIndex() const { return lastPxIndex; }

// Returns a pointer to the first pixel of the segment
inline const Pixel *begin() const { return &((*pixels)[firstPxIndex]); }

Expand Down