本文整理汇总了C++中py::SeqBase类的典型用法代码示例。如果您正苦于以下问题:C++ SeqBase类的具体用法?C++ SeqBase怎么用?C++ SeqBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SeqBase类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ValueError
Py::Object
_path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args)
{
args.verify_length(2);
Py::Object bbox = args[0];
Py::SeqBase<Py::Object> bboxes = args[1];
double ax0, ay0, ax1, ay1;
double bx0, by0, bx1, by1;
long count = 0;
if (py_convert_bbox(bbox.ptr(), ax0, ay0, ax1, ay1))
{
if (ax1 < ax0)
{
std::swap(ax0, ax1);
}
if (ay1 < ay0)
{
std::swap(ay0, ay1);
}
size_t num_bboxes = bboxes.size();
for (size_t i = 0; i < num_bboxes; ++i)
{
Py::Object bbox_b = bboxes[i];
if (py_convert_bbox(bbox_b.ptr(), bx0, by0, bx1, by1))
{
if (bx1 < bx0)
{
std::swap(bx0, bx1);
}
if (by1 < by0)
{
std::swap(by0, by1);
}
if (!((bx1 <= ax0) ||
(by1 <= ay0) ||
(bx0 >= ax1) ||
(by0 >= ay1)))
{
++count;
}
}
else
{
throw Py::ValueError("Non-bbox object in bboxes list");
}
}
}
else
{
throw Py::ValueError("First argument to count_bboxes_overlapping_bbox must be a Bbox object.");
}
return Py::Int(count);
}