Changeset 1497 for trunk/src


Ignore:
Timestamp:
02/04/09 17:42:20 (16 years ago)
Author:
Max Voronkov
Message:

fixed #149. The problem was inside getMask method. In some rare circumstances largely when single channel detections are allowed and with spectral averaging enabled, the method failed to flag the lines which have already been detected and went into infinite loop by detecting them again. The condition of leaving the loop (no new lines found) was never satisfied as a result of this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STLineFinder.cpp

    r1315 r1497  
    870870       // iterator through lines
    871871       std::list<std::pair<int,int> >::const_iterator cli=lines.begin();
    872        for (int ch=0;ch<int(res_mask.size());++ch)
     872       for (int ch=0;ch<int(res_mask.size());++ch) {
    873873            if (ch<edge.first || ch>=edge.second) res_mask[ch]=false;
    874874            else if (!mask[ch]) res_mask[ch]=false;
    875875            else {
    876876                    res_mask[ch]=!invert; // no line by default
    877                     if (cli==lines.end()) continue;
    878                     if (ch>=cli->first && ch<cli->second)
    879                         res_mask[ch]=invert; // this is a line
    880                     if (ch>=cli->second)
    881                         ++cli; // next line in the list
    882                  }
    883 
     877                    if (cli!=lines.end())
     878                        if (ch>=cli->first && ch<cli->second)
     879                             res_mask[ch]=invert; // this is a line
     880            }
     881            if (cli!=lines.end())
     882                if (ch>=cli->second) {
     883                    ++cli; // next line in the list
     884                }
     885       }
    884886       return res_mask;
    885887  }
Note: See TracChangeset for help on using the changeset viewer.