- reenabled intersection test
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@469 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -341,10 +341,24 @@ namespace gr {
|
||||
.half_width = (float)pbh,
|
||||
.height_rel = m_pXd[pos],
|
||||
.height_abs = m_pX[pos],
|
||||
.isConfirmed = true,
|
||||
};
|
||||
|
||||
m_peakList.push_back(peak);
|
||||
m_peak_id++;
|
||||
// Intersection check
|
||||
bool intersection = false;
|
||||
for (int i = 0; i < m_peakList.size(); i++)
|
||||
{
|
||||
if (m_peakList[i].isInRange(peak))
|
||||
{
|
||||
intersection = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!intersection)
|
||||
{
|
||||
m_peakList.push_back(peak);
|
||||
m_peak_id++;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
@@ -354,14 +368,13 @@ namespace gr {
|
||||
for (int i = 0; i < m_peakList.size(); i++)
|
||||
{
|
||||
Peak &peak = m_peakList[i];
|
||||
|
||||
|
||||
bool found = false;
|
||||
for (int j=0; j < m_peakHistory.size(); j++)
|
||||
{
|
||||
if (m_peakHistory[j].isInRange(peak))
|
||||
{
|
||||
Peak p = m_peakHistory[j].update(peak);
|
||||
temp.push_back(p);
|
||||
temp.push_back(m_peakHistory[j].update(peak));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -369,9 +382,21 @@ namespace gr {
|
||||
|
||||
if (!found)
|
||||
{
|
||||
peak.isConfirmed = 1;
|
||||
temp.push_back(peak);
|
||||
fprintf(stderr, "New Peak #%u at %d\n", (int)peak.id, (int)peak.pos);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j=0; j < m_peakHistory.size(); j++)
|
||||
{
|
||||
Peak &peak = m_peakHistory[j];
|
||||
if (!peak.isConfirmed)
|
||||
{
|
||||
fprintf(stderr, "Lost Peak #%u at %d\n", (int)peak.id, (int)peak.pos);
|
||||
}
|
||||
}
|
||||
m_peakHistory.clear();
|
||||
m_peakHistory = temp;
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
@@ -412,6 +437,7 @@ namespace gr {
|
||||
pmt::pmt_t tag_key = pmt::string_to_symbol(std::string("pos_id_") + std::to_string(peak.id));
|
||||
pmt::pmt_t tag_value = pmt::from_long(peak.pos);
|
||||
add_item_tag(DATA, nitems_written(DATA) + k, tag_key, tag_value, m_tag_id);
|
||||
peak.isConfirmed = false;
|
||||
}
|
||||
|
||||
m_frameCount++;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace jay {
|
||||
float half_width;
|
||||
float height_rel;
|
||||
float height_abs;
|
||||
bool isConfirmed;
|
||||
|
||||
bool isInRange(const Peak &other)
|
||||
{
|
||||
@@ -49,7 +50,7 @@ namespace jay {
|
||||
half_width = alpha*half_width + beta*other.half_width;
|
||||
height_rel = std::max(height_rel, other.height_rel);
|
||||
height_abs = std::max(height_abs, other.height_abs);
|
||||
|
||||
isConfirmed = true;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user