python的PCLines转换
pclines的Python项目详细描述
^Python的{}包
这个软件包实现了一个PCLines转换,用于图像中的线检测。在
@INPROCEEDINGS{dubska2011pclines,author={M. {Dubská} and A. {Herout} and J. {Havel}},booktitle={CVPR 2011},title={PClines — Line detection using parallel coordinates},year={2011},}
要求
- Python 3.6+
- numpy公司
- 麻木
- scikit图像
安装
包在PyPI上,所以只需运行以下命令并安装包。在
^{pr2}$或者,您可以下载此存储库并手动安装。在
示例
- 导入程序包
importpclinesaspcl
- 数据和观察 观测值是由已知边界框包围的二维加权坐标。作为一个例子,我们从图像中提取边缘点。在
image=imread("doc/test.png",as_gray=True)edges=sobel(image)r,c=np.nonzero(edges>0.5)x=np.array([c,r],"i").Tweights=edges[r,c]
- PCLines空间的累积
h,w=image.shape[:2]bbox=(0,0,w,h)# Bounding box of observationsd=1024# Accumulator resolutionP=PCLines(bbox,d)# Create new accumulatorP.insert(x,weights)# Insert observationsp,w=P.find_peaks(min_dist=10,prominence=1.3,t=0.1)# Find local maxima
- 检测到的线路
h=P.inverse(p)# (a,b,c) parameters of linesX,Y=utils.line_segments_from_homogeneous(h,bbox)# Convert to line segments for plotting
贡献
如果您有改进建议,请填写问题让我们知道。或者,您可以分叉项目并提交请求。在
- 项目
标签: