当前位置: 首页>>代码示例>>Python>>正文


Python data.camera方法代码示例

本文整理汇总了Python中skimage.data.camera方法的典型用法代码示例。如果您正苦于以下问题:Python data.camera方法的具体用法?Python data.camera怎么用?Python data.camera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skimage.data的用法示例。


在下文中一共展示了data.camera方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MR_showsuperpixel

# 需要导入模块: from skimage import data [as 别名]
# 或者: from skimage.data import camera [as 别名]
def MR_showsuperpixel(self,img=None):
        if img == None:
            img = cv2.cvtColor(camera(),cv2.COLOR_RGB2BGR)
        img = self._MR_saliency__MR_readimg(img)
        labels = self._MR_saliency__MR_superpixel(img)

        plt.axis('off')
        plt.imshow(mark_boundaries(img,labels))
        plt.show() 
开发者ID:ruanxiang,项目名称:mr_saliency,代码行数:11,代码来源:MR.py

示例2: setUpClass

# 需要导入模块: from skimage import data [as 别名]
# 或者: from skimage.data import camera [as 别名]
def setUpClass(cls):
        cls._G = graphs.Logo()
        cls._G.compute_fourier_basis()

        cls._rs = np.random.RandomState(42)
        cls._signal = cls._rs.uniform(size=cls._G.N)

        cls._img = img_as_float(data.camera()[::16, ::16]) 
开发者ID:epfl-lts2,项目名称:pygsp,代码行数:10,代码来源:test_graphs.py

示例3: setUpClass

# 需要导入模块: from skimage import data [as 别名]
# 或者: from skimage.data import camera [as 别名]
def setUpClass(cls):
        cls._img = img_as_float(data.camera()[::16, ::16]) 
开发者ID:epfl-lts2,项目名称:pygsp,代码行数:4,代码来源:test_plotting.py

示例4: run_all_profiles

# 需要导入模块: from skimage import data [as 别名]
# 或者: from skimage.data import camera [as 别名]
def run_all_profiles():
    print('running profiler...')
    spokelength = 512
    nspokes = 405
    ncoil = 15

    print('problem size (radial trajectory, 2-factor oversampling):')
    print('number of coils: {}'.format(ncoil))
    print('number of spokes: {}'.format(nspokes))
    print('spokelength: {}'.format(spokelength))

    # create an example to run on
    image = np.array(Image.fromarray(camera()).resize((256, 256)))
    image = image.astype(np.complex)
    im_size = image.shape

    image = np.stack((np.real(image), np.imag(image)))
    image = torch.tensor(image).unsqueeze(0).unsqueeze(0)

    # create k-space trajectory
    ga = np.deg2rad(180 / ((1 + np.sqrt(5)) / 2))
    kx = np.zeros(shape=(spokelength, nspokes))
    ky = np.zeros(shape=(spokelength, nspokes))
    ky[:, 0] = np.linspace(-np.pi, np.pi, spokelength)
    for i in range(1, nspokes):
        kx[:, i] = np.cos(ga) * kx[:, i - 1] - np.sin(ga) * ky[:, i - 1]
        ky[:, i] = np.sin(ga) * kx[:, i - 1] + np.cos(ga) * ky[:, i - 1]

    ky = np.transpose(ky)
    kx = np.transpose(kx)

    ktraj = np.stack((ky.flatten(), kx.flatten()), axis=0)

    ktraj = torch.tensor(ktraj).unsqueeze(0)

    smap_sz = (1, ncoil, 2) + im_size
    smap = torch.ones(*smap_sz)

    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cpu'), sparse_mats_flag=False)
    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cpu'), sparse_mats_flag=True)
    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cpu'), use_toep=True)
    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cuda'), sparse_mats_flag=False)
    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cuda'), sparse_mats_flag=True)
    profile_torchkbnufft(image, ktraj, smap, im_size, device=torch.device(
        'cuda'), use_toep=True) 
开发者ID:mmuckley,项目名称:torchkbnufft,代码行数:52,代码来源:profile_torchkbnufft.py

示例5: MR_boundary_saliency

# 需要导入模块: from skimage import data [as 别名]
# 或者: from skimage.data import camera [as 别名]
def MR_boundary_saliency(self,img=None):
        if img == None:
            img = cv2.cvtColor(camera(),cv2.COLOR_RGB2BGR)
        lab_img = self._MR_saliency__MR_readimg(img)
    
        labels = self._MR_saliency__MR_superpixel(lab_img)
        
        up,right,low,left = self._MR_saliency__MR_boundary_indictor(labels)
        aff = self._MR_saliency__MR_affinity_matrix(lab_img,labels)

        up_sal = 1- self._MR_saliency__MR_saliency(aff,up)
        up_img = self._MR_saliency__MR_fill_superpixel_with_saliency(labels,up_sal)
        up_img = up_img.astype(np.uint8)
    
        right_sal = 1-self._MR_saliency__MR_saliency(aff,right)
        right_img =  self._MR_saliency__MR_fill_superpixel_with_saliency(labels,right_sal)
        right_img = right_img.astype(np.uint8)

        low_sal = 1-self._MR_saliency__MR_saliency(aff,low)
        low_img = self._MR_saliency__MR_fill_superpixel_with_saliency(labels,low_sal)
        low_img = low_img.astype(np.uint8)
    
        left_sal = 1-self._MR_saliency__MR_saliency(aff,left)
        left_img = self._MR_saliency__MR_fill_superpixel_with_saliency(labels,left_sal)
        left_img = left_img.astype(np.uint8)
        

        plt.subplot(3,2,1)
        plt.title('orginal')
        plt.axis('off')
        plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
        
        plt.subplot(3,2,2)
        plt.title('up')
        plt.axis('off')
        plt.imshow(up_img,'gray')
        
        plt.subplot(3,2,3)
        plt.title('right')
        plt.axis('off')
        plt.imshow(right_img,'gray')
        
        plt.subplot(3,2,4)
        plt.title('low')
        plt.axis('off')
        plt.imshow(low_img,'gray')
        
        plt.subplot(3,2,5)
        plt.title('left')
        plt.axis('off')
        plt.imshow(left_img,'gray')
        
        plt.subplot(3,2,6)
        plt.title('integrated')
        plt.axis('off')
        saliency_map = MR_debuger().saliency(img).astype(np.uint8)
        plt.imshow( saliency_map,'gray')
        plt.show() 
开发者ID:ruanxiang,项目名称:mr_saliency,代码行数:60,代码来源:MR.py


注:本文中的skimage.data.camera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。