• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python viewer.ImageViewer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skimage.viewer.ImageViewer的典型用法代码示例。如果您正苦于以下问题:Python ImageViewer类的具体用法?Python ImageViewer怎么用?Python ImageViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_plot_plugin

def test_plot_plugin():
    viewer = ImageViewer(data.moon())
    plugin = PlotPlugin(image_filter=lambda x: x)
    viewer += plugin

    assert_equal(viewer.image, data.moon())
    plugin._update_original_image(data.coins())
    assert_equal(viewer.image, data.coins())
    viewer.close()
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:9,代码来源:test_plugins.py


示例2: test_canny

def test_canny():
    image = data.camera()
    viewer = ImageViewer(image)
    c = CannyPlugin()
    viewer += c

    canny_edges = viewer.show(False)
    viewer.close()
    edges = canny_edges[0][0]
    assert edges.sum() == 2852
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:10,代码来源:test_plugins.py


示例3: show_disparity_map

def show_disparity_map(disparity_map):
    #Scale to zero:
    image = np.subtract(disparity_map, np.min(disparity_map))

    if np.max(image) != 0:
        #Normalize and invert:
        image = np.multiply(image, 255.0/float(np.max(image)))

    #Show the stuff:
    viewer = ImageViewer(image.astype(np.uint8))
    viewer.show()
开发者ID:MichSchli,项目名称:Stereo-correspondence,代码行数:11,代码来源:StereoAnalyser.py


示例4: test_viewer_with_overlay

def test_viewer_with_overlay():
    img = data.coins()
    ov = OverlayPlugin(image_filter=sobel)
    viewer = ImageViewer(img)
    viewer += ov

    import tempfile
    _, filename = tempfile.mkstemp(suffix='.png')

    ov.color = 3
    assert_equal(ov.color, 'yellow')
    viewer.save_to_file(filename)
    ov.display_filtered_image(img)
    assert_equal(ov.overlay, img)
    ov.overlay = None
    assert_equal(ov.overlay, None)
    ov.overlay = img
    assert_equal(ov.overlay, img)
    assert_equal(ov.filtered_image, img)
开发者ID:ramosapf,项目名称:scikit-image,代码行数:19,代码来源:test_viewer.py


示例5: test_line_profile_dynamic

def test_line_profile_dynamic():
    """Test a line profile updating after an image transform"""
    image = data.coins()[:-50, :]  # shave some off to make the line lower
    image = skimage.img_as_float(image)
    viewer = ImageViewer(image)

    lp = LineProfile(limits='dtype')
    viewer += lp

    line = lp.get_profiles()[-1][0]
    assert line.size == 129
    assert_almost_equal(np.std(viewer.image), 0.208, 3)
    assert_almost_equal(np.std(line), 0.229, 3)
    assert_almost_equal(np.max(line) - np.min(line), 0.725, 1)

    viewer.image = skimage.img_as_float(median(image,
                                               selem=disk(radius=3)))

    line = lp.get_profiles()[-1][0]
    assert_almost_equal(np.std(viewer.image), 0.198, 3)
    assert_almost_equal(np.std(line), 0.220, 3)
    assert_almost_equal(np.max(line) - np.min(line), 0.639, 1)
开发者ID:Rapternmn,项目名称:scikit-image,代码行数:22,代码来源:test_plugins.py


示例6: OverlayPlugin

from skimage import data
from skimage.filters import canny

from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider
from skimage.viewer.widgets.history import SaveButtons
from skimage.viewer.plugins.overlayplugin import OverlayPlugin


image = data.camera()

# You can create a UI for a filter just by passing a filter function...
plugin = OverlayPlugin(image_filter=canny)
# ... and adding widgets to adjust parameter values.
plugin += Slider('sigma', 0, 5)
plugin += Slider('low threshold', 0, 255)
plugin += Slider('high threshold', 0, 255)
# ... and we can also add buttons to save the overlay:
plugin += SaveButtons(name='Save overlay to:')

# Finally, attach the plugin to an image viewer.
viewer = ImageViewer(image)
viewer += plugin
canny_edges = viewer.show()[0][0]
开发者ID:JeanKossaifi,项目名称:scikit-image,代码行数:24,代码来源:canny_simple.py


示例7: show

 def show(self):
     viewer = ImageViewer(self.image)
     viewer.show()
开发者ID:ZetaPhase,项目名称:ZetaPic,代码行数:3,代码来源:transform.py


示例8: viewImage

 def viewImage(image):
     viewer = ImageViewer(image)
     viewer.show()
开发者ID:mohammad-abdulkhaliq,项目名称:iMachine,代码行数:3,代码来源:color.py


示例9: testinterp

def testinterp(noiselevel, pointfrac):

    # Definitions
    dimx     = 100
    dimy     = 100
    dens     = 0.1
    dx2      = dimx/2
    dy2      = dimy/2
    startval = 3.0
    l   = 0.01
    maxitt   = 10

    # define ground truth
    GT = np.zeros((dimx, dimy))
    GT[0:dx2,0:dy2] = - 10.0
    GT[0:dx2,dy2+1:] = 0.0
    GT[dx2+1:,0:dy2] = 5.0
    GT[dx2+1:,dy2+1:] = 15.0

    # generate data
    Data = GT + noiselevel*np.random.randn(dimx,dimy)
    points = (np.random.rand(dimx,dimy) < pointfrac)
    values = np.multiply((1*points), Data)
    start = startval*np.ones((dimx,dimy))

    print "Interpolating..."
    Ipim = interp(start, points, values, maxitt, l)
    print "Done!"

    # compare and display result

    err1 = (Data - Ipim)
    err = np.absolute(Data - Ipim)
    errsq = err1.dot(err1)

    rms= math.sqrt(errsq.sum())/float(dimx*dimy)
    print 'average reconstruction error:', rms

    shGT = GT - GT.min()
    shGT = shGT/float(shGT.max())
    shIp = Ipim - Ipim.min()
    shIp = shIp/float(shIp.max())
    sher = err - err.min()
    sher = sher/float(sher.max())

    #h = figure(1);
    #subplot(2,2,1);

    print "ground truth"
    view = ImageViewer(shGT)
    view.show()

    print 'Reconstruction'
    view = ImageViewer(shIp)
    view.show()


    print 'Sparse point position'
    view = ImageViewer(points)
    view.show()

    print 'Reconstruction error'
    view = ImageViewer(sher)
    view.show()
开发者ID:MichSchli,项目名称:Stereo-correspondence,代码行数:64,代码来源:Helper.py


示例10: check

def check(train_set_x, train_set_y, val_set_x, val_set_y):

    print(train_set_y[0])
    viewer = ImageViewer(train_set_x[0])
    viewer.show()

    print(train_set_y[10])
    viewer = ImageViewer(train_set_x[10])
    viewer.show()

    print(train_set_y[32])
    viewer = ImageViewer(train_set_x[32])
    viewer.show()

    print(train_set_y[56])
    viewer = ImageViewer(train_set_x[56])
    viewer.show()

    print(train_set_y[76])
    viewer = ImageViewer(train_set_x[76])
    viewer.show()

    print(train_set_y[119])
    viewer = ImageViewer(train_set_x[119])
    viewer.show()

    print(val_set_y[5])
    viewer = ImageViewer(val_set_x[5])
    viewer.show()

    print(val_set_y[13])
    viewer = ImageViewer(val_set_x[13])
    viewer.show()

    print(val_set_y[32])
    viewer = ImageViewer(val_set_x[32])
    viewer.show()

    print(val_set_y[51])
    viewer = ImageViewer(val_set_x[51])
    viewer.show()

    print(val_set_y[75])
    viewer = ImageViewer(val_set_x[75])
    viewer.show()

    print(val_set_y[145])
    viewer = ImageViewer(val_set_x[145])
    viewer.show()
开发者ID:leovetter,项目名称:cbir,代码行数:49,代码来源:algos.py


示例11: show_matching

def show_matching(img, img2, matching):
    print "matching..."
    ip_match = build_match_dic(img, img2, matching)

    print "Constructing intermediate image..."
    padding = 5 #padding around the edges

    bar = np.ndarray((img.shape[0], 5))
    bar.fill(1.0)
    viewer = ImageViewer(img)
    viewer.show()
    img3 = np.column_stack((img, bar, img2))
    viewer = ImageViewer(img3)
    viewer.show()

    img3 = img_as_ubyte(img3)

    viewer = ImageViewer(img3)
    viewer.show()

    img3 = np.pad(img3, pad_width=padding, mode='constant', constant_values=(0))


    viewer = ImageViewer(img3)
    viewer.show()
    print "Drawing lines..."

    colimg = color.gray2rgb(img3)
    for k,v in random.sample(ip_match.items(), int(float(len(ip_match.keys()))*0.005)):
        #Choose a random colour:
        col = [random.randint(0,255),random.randint(0,255),random.randint(0,255)]

        #Calculate coordinates after padding:
        x1 = k[0]+padding
        y1 = k[1]+padding
        x2 = v[0]+padding
        y2 = v[1] + img.shape[1]+bar.shape[1]+padding

        #Draw the points in both images:
        rr, cc = circle_perimeter(x1, y1, 3)
        colimg[rr, cc] = col
        rr, cc = circle_perimeter(x2, y2, 3)
        colimg[rr, cc] = col

        #Draw a line between the points:
        rr, cc = line(x1,y1,x2,y2)
        colimg[rr, cc] = col

    #Show the result:
    viewer = ImageViewer(colimg)
    viewer.show()
开发者ID:MichSchli,项目名称:Stereo-correspondence,代码行数:51,代码来源:StereoAnalyser.py


示例12: line_image

from skimage.viewer.plugins.canny import CannyPlugin


def line_image(shape, lines):
    image = np.zeros(shape, dtype=bool)
    for end_points in lines:
        end_points = np.asarray(end_points)[:, ::-1]
        image[draw.line(*np.ravel(end_points))] = 1
    return image


def hough_lines(image, *args, **kwargs):
    lines = probabilistic_hough_line(image, threshold=0.5, *args, **kwargs)
    image = line_image(image.shape, lines)
    return image


image = data.camera()
canny_viewer = ImageViewer(image)
canny_plugin = CannyPlugin()
canny_viewer += canny_plugin

hough_plugin = OverlayPlugin(image_filter=hough_lines)
hough_plugin += Slider('line length', 0, 100, value=100, update_on='move')
hough_plugin += Slider('line gap', 0, 20, value=0, update_on='move')

hough_viewer = ImageViewer(canny_plugin)
hough_viewer += hough_plugin

canny_viewer.show()
开发者ID:AllenDowney,项目名称:skimage-tutorials,代码行数:30,代码来源:7_probabilistic_hough.py


示例13: ImageViewer

from skimage import data
from skimage.viewer import ImageViewer
from skimage.viewer.plugins.lineprofile import LineProfile


image = data.camera()
viewer = ImageViewer(image)
viewer += LineProfile()
line, profile = viewer.show()[0]
开发者ID:A-0-,项目名称:scikit-image,代码行数:9,代码来源:lineprofile.py


示例14: test_viewer

def test_viewer():
    astro = data.astronaut()
    coins = data.coins()

    view = ImageViewer(astro)
    import tempfile
    _, filename = tempfile.mkstemp(suffix='.png')

    view.show(False)
    view.close()
    view.save_to_file(filename)
    view.open_file(filename)
    assert_equal(view.image, astro)
    view.image = coins
    assert_equal(view.image, coins),
    view.save_to_file(filename),
    view.open_file(filename),
    view.reset_image(),
    assert_equal(view.image, coins)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:19,代码来源:test_viewer.py


示例15: ImageViewer

from skimage import data
from skimage.viewer import ImageViewer
from skimage.viewer.plugins.lineprofile import LineProfile


image = data.chelsea()
viewer = ImageViewer(image)
viewer += LineProfile()
line, rgb_profiles = viewer.show()[0]
开发者ID:A-0-,项目名称:scikit-image,代码行数:9,代码来源:lineprofile_rgb.py


示例16: median_filter

from skimage import data
from skimage.filters.rank import median
from skimage.morphology import disk

from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons
from skimage.viewer.plugins.base import Plugin

def median_filter(image, radius):
    return median(image, selem=disk(radius))

image = data.coins()
viewer = ImageViewer(image)

plugin = Plugin(image_filter=median_filter)
plugin += Slider('radius', 2, 10, value_type='int')
plugin += SaveButtons()
plugin += OKCancelButtons()

viewer += plugin
viewer.show()
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:21,代码来源:median_filter.py


示例17: ImageViewer

import skimage as sk
from skimage.viewer import ImageViewer

#import TomographyTools as tt
#import TomographyTools.data_management as dm
#import TomographyTools.reconstruciton as rn
import TomographyTools.image_processing as ip

inputDir = "/home/[email protected]/data-scratch/20171006_ChaiLor_PaintData/rec20171005_162920_TiO2_sample1/"

inputDirs = ['/home/[email protected]/data-scratch/20171006_ChaiLor_PaintData/rec20171005_155036_TiO2_control_scan2',
    "/home/[email protected]/data-scratch/20171006_ChaiLor_PaintData/rec20171005_162920_TiO2_sample1/",
    '/home/[email protected]/data-scratch/20171006_ChaiLor_PaintData/rec20171005_165313_TiO2_sample2',
    '/home/[email protected]/data-scratch/20171006_ChaiLor_PaintData/rec20171005_172237_TiO2_sample3']

if True:
    ip.convert_DirectoryTo8Bit(inputpath=inputDirs[0],data_min=-5.0,data_max=7.0)
    ip.convert_DirectoryTo8Bit(inputpath=inputDirs[1],data_min=-5.0,data_max=7.0)
    ip.convert_DirectoryTo8Bit(inputpath=inputDirs[2],data_min=-5.0,data_max=7.0)
    ip.convert_DirectoryTo8Bit(inputpath=inputDirs[3],data_min=-5.0,data_max=7.0)

if False:
    imageStack = ip.loadDataStack(inputDir)
    imageStack8Bit = ip.convert8bit(imageStack,-5.0,7.0)

    ip.saveTiffStack(imageStack,filename="testStack_8Bit")

    image = imageStack8Bit[:,:,50]
    viewer = ImageViewer(image); viewer.show()
开发者ID:hbar,项目名称:python-TomographyTools,代码行数:29,代码来源:test2_LoadData_8BitConversion.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python skin.applyAllAttributes函数代码示例发布时间:2022-05-27
下一篇:
Python shape.view_as_windows函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap