本文整理汇总了C++中Star::WasFound方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::WasFound方法的具体用法?C++ Star::WasFound怎么用?C++ Star::WasFound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Star
的用法示例。
在下文中一共展示了Star::WasFound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoFind
//.........这里部分代码省略.........
// erase the dimmer one
stars.erase(a);
goto repeat;
}
}
}
}
// exclude stars that would fit within a single searchRegion box
{
// build a list of stars to be excluded
std::set<int> to_erase;
const int extra = 5; // extra safety margin
const int fullw = searchRegion + extra;
for (std::set<Peak>::const_iterator a = stars.begin(); a != stars.end(); ++a)
{
std::set<Peak>::const_iterator b = a;
++b;
for (; b != stars.end(); ++b)
{
int dx = abs(a->x - b->x);
int dy = abs(a->y - b->y);
if (dx <= fullw && dy <= fullw)
{
// stars closer than search region, exclude them both
// but do not let a very dim star eliminate a very bright star
if (b->val / a->val >= 5.0)
{
Debug.AddLine("AutoFind: close dim-bright [%d, %d] %.1f - [%d, %d] %.1f", a->x, a->y, a->val, b->x, b->y, b->val);
}
else
{
Debug.AddLine("AutoFind: too close [%d, %d] %.1f - [%d, %d] %.1f", a->x, a->y, a->val, b->x, b->y, b->val);
to_erase.insert(std::distance(stars.begin(), a));
to_erase.insert(std::distance(stars.begin(), b));
}
}
}
}
RemoveItems(stars, to_erase);
}
// exclude stars too close to the edge
{
enum { MIN_EDGE_DIST = 40 };
int edgeDist = MIN_EDGE_DIST + extraEdgeAllowance;
std::set<Peak>::iterator it = stars.begin();
while (it != stars.end())
{
std::set<Peak>::iterator next = it;
++next;
if (it->x <= edgeDist || it->x >= image.Size.GetWidth() - edgeDist ||
it->y <= edgeDist || it->y >= image.Size.GetHeight() - edgeDist)
{
Debug.AddLine("AutoFind: too close to edge [%d, %d] %.1f", it->x, it->y, it->val);
stars.erase(it);
}
it = next;
}
}
// At first I tried running Star::Find on the survivors to find the best
// star. This had the unfortunate effect of locating hot pixels which
// the psf convolution so nicely avoids. So, don't do that! -ag
// find the brightest non-saturated star. If no non-saturated stars, settle for a saturated star.
bool allowSaturated = false;
while (true)
{
Debug.AddLine("AutoSelect: finding best star allowSaturated = %d", allowSaturated);
for (std::set<Peak>::reverse_iterator it = stars.rbegin(); it != stars.rend(); ++it)
{
Star tmp;
tmp.Find(&image, searchRegion, it->x, it->y, FIND_CENTROID);
if (tmp.WasFound())
{
if (tmp.GetError() == STAR_SATURATED && !allowSaturated)
{
Debug.AddLine("Autofind: star saturated [%d, %d] %.1f Mass %.f SNR %.1f", it->x, it->y, it->val, tmp.Mass, tmp.SNR);
continue;
}
SetXY(it->x, it->y);
Debug.AddLine("Autofind returns star at [%d, %d] %.1f Mass %.f SNR %.1f", it->x, it->y, it->val, tmp.Mass, tmp.SNR);
return true;
}
}
if (allowSaturated)
break; // no stars found
Debug.AddLine("AutoFind: could not find a non-saturated star!");
allowSaturated = true;
}
Debug.AddLine("Autofind: no star found");
return false;
}
示例2: AutoFind
//.........这里部分代码省略.........
std::set<Peak>::iterator it = stars.begin();
while (it != stars.end())
{
std::set<Peak>::iterator next = it;
++next;
if (it->x <= edgeDist || it->x >= image.Size.GetWidth() - edgeDist ||
it->y <= edgeDist || it->y >= image.Size.GetHeight() - edgeDist)
{
Debug.Write(wxString::Format("AutoFind: too close to edge [%d, %d] %.1f\n", it->x, it->y, it->val));
stars.erase(it);
}
it = next;
}
}
// At first I tried running Star::Find on the survivors to find the best
// star. This had the unfortunate effect of locating hot pixels which
// the psf convolution so nicely avoids. So, don't do that! -ag
// try to identify the saturation point
// first, find the peak pixel overall
unsigned short maxVal = 0;
for (unsigned int i = 0; i < image.NPixels; i++)
if (image.ImageData[i] > maxVal)
maxVal = image.ImageData[i];
// next see if any of the stars has a flat-top
bool foundSaturated = false;
for (std::set<Peak>::reverse_iterator it = stars.rbegin(); it != stars.rend(); ++it)
{
Star tmp;
tmp.Find(&image, searchRegion, it->x, it->y, FIND_CENTROID);
if (tmp.WasFound() && tmp.GetError() == STAR_SATURATED)
{
if ((maxVal - tmp.PeakVal) * 255U > maxVal)
{
// false positive saturation, flat top but below maxVal
Debug.Write(wxString::Format("AutoSelect: false positive saturation peak = %hu, max = %hu\n", tmp.PeakVal, maxVal));
}
else
{
// a saturated star was found
foundSaturated = true;
break;
}
}
}
unsigned int sat_level; // saturation level, including pedestal
if (foundSaturated)
{
// use the peak overall pixel value as the saturation limit
Debug.Write(wxString::Format("AutoSelect: using saturation level peakVal = %hu\n", maxVal));
sat_level = maxVal; // includes pedestal
}
else
{
// no staurated stars found, can't make any assumption about whether the max val is saturated
Debug.Write(wxString::Format("AutoSelect: using saturation level from BPP %u and pedestal %hu\n",
image.BitsPerPixel, image.Pedestal));
sat_level = ((1U << image.BitsPerPixel) - 1) + image.Pedestal;
if (sat_level > 65535)
sat_level = 65535;