本文整理汇总了C++中GeoImage::geo2picY方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoImage::geo2picY方法的具体用法?C++ GeoImage::geo2picY怎么用?C++ GeoImage::geo2picY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoImage
的用法示例。
在下文中一共展示了GeoImage::geo2picY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeInto
/** Merge the region with the id from labelimage img into this image with the newId, if the previous id in this image is compareId */
bool GeoImage::mergeInto(GeoImage & img, int compareId, int id, int newId)
{
int llx, lly, urx, ury;
int x, y;
bool objectInserted = false;
#ifdef WIN32
#pragma message ("besser picBBox benutzen?")
#else
#warning besser picBBox benutzen?
#endif
llx = int (geo2picX(img.pic2geoX(0)));
lly = int (geo2picY(img.pic2geoY(img.rows())));
urx = int (geo2picX(img.pic2geoX(img.cols())));
ury = int (geo2picY(img.pic2geoY(0)));
if (llx < 0)
llx = 0;
if (lly >= rows_)
lly = rows_;
if (urx >= cols_)
urx = cols_;
if (ury < 0)
ury = 0;
//! This loop should be optimized
for (y = ury; y < lly; y++)
for (x = llx; x < urx; x++) {
#if 0
Q_ASSERT(x >= 0);
Q_ASSERT(x < cols());
Q_ASSERT(y >= 0);
Q_ASSERT(y < rows());
#endif
if (getId(x, y) != compareId)
continue;
float gx, gy;
gx = pic2geoX(x);
gy = pic2geoY(y);
int nx, ny;
nx = int (img.geo2picX(gx));
ny = int (img.geo2picY(gy));
#if 0
Q_ASSERT(nx >= 0);
Q_ASSERT(nx < img.cols());
Q_ASSERT(ny >= 0);
Q_ASSERT(ny < img.rows());
#endif
if (img.getId(nx, ny) == id) {
// qDebug("GeoImage::mergeInto 1->(%d,%d)",x,y);
((int *) data_)[y * cols_ + x] = newId;
objectInserted = true;
}
}
return objectInserted;
}