test.py 文件源码

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

项目:dilation 作者: fyu 项目源码 文件源码
def write_array(filename, array):
    with open(filename, 'wb') as fp:
        if array.dtype == np.float32:
            typecode = cv2.CV_32F
        elif array.dtype == np.float64:
            typecode = cv2.CV_64F
        else:
            raise ValueError("type is not supported")
        fp.write(np.array(typecode, dtype=np.int32).tostring())
        fp.write(np.array(len(array.shape), dtype=np.int32).tostring())
        fp.write(np.array(array.shape, dtype=np.int32).tostring())
        fp.write(array.tostring())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号