morphology_utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Shoe-Shape-Classifier 作者: jrzaurin 项目源码 文件源码
def plot_shape(img, axis, df=None, nsteps=None):
    """
    function to overplot the shape points onto the image img
    """

    if df is not None and nsteps:
        print 'Error: provide data frame or nsteps, not both'
        return None

    if df is not None:
        edges = bounding_box(img)
        img_c = img[edges[2]:edges[3]+1, edges[0]:edges[1]+1]
        pyl.figure()
        pyl.gray()
        pyl.imshow(img_c)
        if axis == 'y':
            pyl.plot(df.init,df.coord, 'r*')
            pyl.plot(df.end, df.coord, 'r*')
            pyl.show()
        if axis == 'x':
            pyl.plot(df.coord,df.init, 'r*')
            pyl.plot(df.coord,df.end, 'r*')
            pyl.show()

    elif nsteps:
        pyl.figure()
        pyl.gray()
        pyl.imshow(img)
        if axis == 'y':
            df = shape_df(img, 'y', nsteps)
            pyl.plot(df.init,df.coord, 'r*')
            pyl.plot(df.end, df.coord, 'r*')
            pyl.show()
        if axis == 'x':
            df = shape_df(img, 'x', nsteps)
            pyl.plot(df.coord,df.init, 'r*')
            pyl.plot(df.coord,df.end, 'r*')
            pyl.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号