objects.py 文件源码

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

项目:prysm 作者: brandondube 项目源码 文件源码
def __init__(self, width, sample_spacing=0.025, samples=384):
        ''' Produces a Pinhole.

        Args:
            width (`float`): the width of the pinhole.

            sample_spacing (`float`): spacing of samples in the synthetic image.

            samples (`int`): number of samples per dimension in the synthetic image.

        '''
        self.width = width

        # produce coordinate arrays
        ext = samples / 2 * sample_spacing
        x, y = np.linspace(-ext, ext, samples), np.linspace(-ext, ext, samples)
        xv, yv = np.meshgrid(x, y)
        w = width / 2

        # paint a circle on a black background
        arr = np.zeros((samples, samples))
        arr[sqrt(xv**2 + yv**2) < w] = 1
        super().__init__(data=arr, sample_spacing=sample_spacing, synthetic=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号