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


Python ImageViewer.show方法代码示例

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


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

示例1: show_disparity_map

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:13,代码来源:StereoAnalyser.py

示例2: show_matching

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:53,代码来源:StereoAnalyser.py

示例3: test_viewer

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:21,代码来源:test_viewer.py

示例4: test_canny

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:12,代码来源:test_plugins.py

示例5: median_filter

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:23,代码来源:median_filter.py

示例6: OverlayPlugin

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:26,代码来源:canny_simple.py

示例7: show

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
 def show(self):
     viewer = ImageViewer(self.image)
     viewer.show()
开发者ID:ZetaPhase,项目名称:ZetaPic,代码行数:5,代码来源:transform.py

示例8: viewImage

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
 def viewImage(image):
     viewer = ImageViewer(image)
     viewer.show()
开发者ID:mohammad-abdulkhaliq,项目名称:iMachine,代码行数:5,代码来源:color.py

示例9: testinterp

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:66,代码来源:Helper.py

示例10: ImageViewer

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:11,代码来源:lineprofile_rgb.py

示例11: line_image

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:32,代码来源:7_probabilistic_hough.py

示例12: ImageViewer

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:11,代码来源:lineprofile.py

示例13: check

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:51,代码来源:algos.py

示例14: ImageViewer

# 需要导入模块: from skimage.viewer import ImageViewer [as 别名]
# 或者: from skimage.viewer.ImageViewer import show [as 别名]
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,代码行数:31,代码来源:test2_LoadData_8BitConversion.py


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