本文整理汇总了Python中shapely.geometry.Point方法的典型用法代码示例。如果您正苦于以下问题:Python geometry.Point方法的具体用法?Python geometry.Point怎么用?Python geometry.Point使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块shapely.geometry的用法示例。
在下文中一共展示了geometry.Point方法的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: saveimageWithMask
点赞 9
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def saveimageWithMask(img, outname, mask_poly):
dstimg = copy.deepcopy(img)
for mask in mask_poly:
bound = mask.bounds
if (len(bound) < 4):
continue
xmin, ymin, xmax, ymax = bound[0], bound[1], bound[2], bound[3]
for x in range(int(xmin), int(xmax)):
for y in range(int(ymin), int(ymax)):
point = shgeo.Point(x, y)
if point.within(mask):
#print('withing')
dstimg[int(y)][int(x)] = 0
cv2.imwrite(outname, dstimg)
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:19,
示例2: removeIgnoredPointsRects
点赞 6
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def removeIgnoredPointsRects(rects,polyList):
ridxs = list(range(len(rects)))
for ridx in range(len(rects)):
points = rects[ridx]["annopoints"][0]["point"]
pidxs = list(range(len(points)))
for pidx in range(len(points)):
pt = geometry.Point(points[pidx]["x"][0], points[pidx]["y"][0])
bIgnore = False
for poidx in range(len(polyList)):
poly = polyList[poidx]
if (poly.contains(pt)):
bIgnore = True
break
if (bIgnore):
pidxs.remove(pidx)
points = [points[pidx] for pidx in pidxs]
if (len(points) > 0):
rects[ridx]["annopoints"][0]["point"] = points
else:
ridxs.remove(ridx)
rects = [rects[ridx] for ridx in ridxs]
return rects
开发者ID:facebookresearch,项目名称:PoseWarper,代码行数:25,
示例3: removeIgnoredPoints
点赞 6
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def removeIgnoredPoints(gtFramesAll,prFramesAll):
imgidxs = []
for imgidx in range(len(gtFramesAll)):
if ("ignore_regions" in gtFramesAll[imgidx].keys() and
len(gtFramesAll[imgidx]["ignore_regions"]) > 0):
regions = gtFramesAll[imgidx]["ignore_regions"]
polyList = []
for ridx in range(len(regions)):
points = regions[ridx]["point"]
pointList = []
for pidx in range(len(points)):
pt = geometry.Point(points[pidx]["x"][0], points[pidx]["y"][0])
pointList += [pt]
poly = geometry.Polygon([[p.x, p.y] for p in pointList])
polyList += [poly]
rects = prFramesAll[imgidx]["annorect"]
prFramesAll[imgidx]["annorect"] = removeIgnoredPointsRects(rects,polyList)
rects = gtFramesAll[imgidx]["annorect"]
gtFramesAll[imgidx]["annorect"] = removeIgnoredPointsRects(rects,polyList)
return gtFramesAll, prFramesAll
开发者ID:facebookresearch,项目名称:PoseWarper,代码行数:25,
示例4: test_vector_concurrent
点赞 6
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def test_vector_concurrent():
def _work(i):
point, = r1.iter_data(None)
return point
ds = buzz.Dataset(max_active=4)
meta = dict(
type='point',
)
p = mp.pool.ThreadPool(4)
with ds.acreate_vector('/tmp/v1.shp', **meta).delete as r1:
pt = sg.Point([42, 45])
r1.insert_data(pt)
r1.deactivate()
points = list(p.map(_work, range(1000)))
assert all(p == pt for p in points)
assert (ds._back.idle_count(), ds._back.used_count(), ds.active_count) == (4, 0, 4)
assert (ds._back.idle_count(r1._back.uid), ds._back.used_count(r1._back.uid), r1.active_count, r1.active) == (4, 0, 4, True)
p.terminate()
开发者ID:airware,项目名称:buzzard,代码行数:25,
示例5: test_points
点赞 6
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def test_points(fps1px):
"""Test points at fps.E's points of interest"""
fps = fps1px
assert fpeq(
fps.E,
fps.AI.intersection(sg.Point(*fps.E.c)),
fps.AI.intersection(sg.Point(*fps.E.t)),
fps.AI.intersection(sg.Point(*fps.E.l)),
fps.AI.intersection(sg.Point(*fps.E.tl)),
)
assert fpeq(
fps.I,
fps.AI.intersection(sg.Point(*fps.E.br)),
)
assert fpeq(
fps.H,
fps.AI.intersection(sg.Point(*fps.E.bl)),
fps.AI.intersection(sg.Point(*fps.E.b)),
)
assert fpeq(
fps.F,
fps.AI.intersection(sg.Point(*fps.E.tr)),
fps.AI.intersection(sg.Point(*fps.E.r)),
)
开发者ID:airware,项目名称:buzzard,代码行数:26,
示例6: _any_geom_to_shapely
点赞 6
# 需要导入模块: from shapely import geometry [as 别名]
# 或者: from shapely.geometry import Point [as 别名]
def _any_geom_to_shapely(geom):
"""Any geom to shapely object. Points should have homogeneous dimensions size."""
if isinstance(geom, (sg.LineString, sg.Point, sg.Polygon, sg.MultiPolygon)):
return geom
if isinstance(geom, dict):
return sg.shape(geom['geometry'])
if isinstance(geom, collections.Container):
geom = np.asarray(geom)
if geom.ndim == 1:
return sg.Point(geom.tolist())
elif geom.ndim == 2:
return sg