- 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,11 +341,25 @@ namespace gr {
|
|||||||
.half_width = (float)pbh,
|
.half_width = (float)pbh,
|
||||||
.height_rel = m_pXd[pos],
|
.height_rel = m_pXd[pos],
|
||||||
.height_abs = m_pX[pos],
|
.height_abs = m_pX[pos],
|
||||||
|
.isConfirmed = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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_peakList.push_back(peak);
|
||||||
m_peak_id++;
|
m_peak_id++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// Peak management
|
// Peak management
|
||||||
@@ -360,8 +374,7 @@ namespace gr {
|
|||||||
{
|
{
|
||||||
if (m_peakHistory[j].isInRange(peak))
|
if (m_peakHistory[j].isInRange(peak))
|
||||||
{
|
{
|
||||||
Peak p = m_peakHistory[j].update(peak);
|
temp.push_back(m_peakHistory[j].update(peak));
|
||||||
temp.push_back(p);
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -369,9 +382,21 @@ namespace gr {
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
peak.isConfirmed = 1;
|
||||||
temp.push_back(peak);
|
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;
|
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_key = pmt::string_to_symbol(std::string("pos_id_") + std::to_string(peak.id));
|
||||||
pmt::pmt_t tag_value = pmt::from_long(peak.pos);
|
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);
|
add_item_tag(DATA, nitems_written(DATA) + k, tag_key, tag_value, m_tag_id);
|
||||||
|
peak.isConfirmed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frameCount++;
|
m_frameCount++;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace jay {
|
|||||||
float half_width;
|
float half_width;
|
||||||
float height_rel;
|
float height_rel;
|
||||||
float height_abs;
|
float height_abs;
|
||||||
|
bool isConfirmed;
|
||||||
|
|
||||||
bool isInRange(const Peak &other)
|
bool isInRange(const Peak &other)
|
||||||
{
|
{
|
||||||
@@ -49,7 +50,7 @@ namespace jay {
|
|||||||
half_width = alpha*half_width + beta*other.half_width;
|
half_width = alpha*half_width + beta*other.half_width;
|
||||||
height_rel = std::max(height_rel, other.height_rel);
|
height_rel = std::max(height_rel, other.height_rel);
|
||||||
height_abs = std::max(height_abs, other.height_abs);
|
height_abs = std::max(height_abs, other.height_abs);
|
||||||
|
isConfirmed = true;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user