コード例 #1
0
ファイル: svdc2.py プロジェクト: aranc/svdaniel
def go(img):
    def preprocess(img):
        U = {}
        V = {}
        s = {}
        for i in (0, 1, 2):
            res = svd(img[...,i], full_matrices=False)
            U[i] = np.mat(res[0])
            V[i] = np.mat(res[2])
            s[i] = res[1]
        return U, V, s

    def display(_, R, G, B):
        rgb = (R, G, B)
        res = np.zeros_like(img)
        for i in (0, 1, 2):
            _s = s[i].copy()
            _s[:rgb[i]] = 0
            S = np.mat(np.diag(_s))
            res[...,i] = U[i]*S*V[i]
        return res

    def _display_all(RGB):
        if RGB in cache: return cache[RGB]
        cache[RGB] = display(None, RGB, RGB, RGB)
        return cache[RGB]

    if os.path.isfile(cache_fname):
        cache = pickle.load(open(cache_fname, "rb"))
        n = len(cache) - 1
        img = _display_all(n)
    else:
        U, V, s = preprocess(img)
        n = len(s[0])
        cache = {}
        for i in range(n + 1):
            print("caching", i)
            _display_all(i)
        with open(cache_fname, "wb") as fh:
            pickle.dump(cache, fh)
        print("wrote to:", cache_fname)


    def display_all(_, RGB):
        return _display_all(RGB)

    viewer = ImageViewer(img)
    plugin = Plugin(image_filter = display_all)
    plugin.name = ""
    plugin += Slider('RGB', 0, n, 0, 'int', update_on='move')
    viewer += plugin
    viewer.show()
コード例 #2
0
 def show_incomplete_image(self, pixels, pos, way=1, if_show=True):
     if way == 0:
         image = np.zeros((self.img_size[0] * self.img_size[1]))
         image[pos] = pixels
         image = image.reshape(self.img_size)
     else:
         image = np.zeros((self.img_size[0] * self.img_size[1], 3))
         image[pos, 0] = pixels
         image = image.reshape(self.img_size + [3])
     if if_show:
         viewer = ImageViewer(image)
         viewer.show()
     return image
コード例 #3
0
def display_conv_relu_pool_block(feature_maps, relu_out, maxpool_out):
    img_list = []
    for i in range(feature_maps.shape[-1]):
        img = np.concatenate((feature_maps[:,:,i],
                              relu_out[:,:,i],
                              resize(maxpool_out[:,:,i],
                                     (relu_out.shape[0],
                                     relu_out.shape[1]))),
                              axis=1)
        img_list.append(img)
    img_final = np.concatenate(([i for i in img_list]), axis=0)

    viewer = ImageViewer(img_final)
    viewer.show()
コード例 #4
0
def get_ROI(im):
    global viewer, coord_list

    selecting = True
    while selecting:
        viewer = ImageViewer(im)
        coord_list = []
        rect_tool = RectangleTool(viewer, on_enter=get_rect_coord)
        print "Draw your selections, press ENTER to validate one and close the window when you are finished"
        viewer.show()
        finished = raw_input('Is the selection correct? [y]/n: ')
        if finished != 'n':
            selecting = False
    return coord_list
コード例 #5
0
 def mark_pixels_on_full_image(self, image0, pos, if_plot=False):
     image = np.zeros((self.img_size[0] * self.img_size[1], 3))
     for n in range(3):
         image[:, n] = image0.reshape(-1, ).copy()
     # image[pos, 0] = (image[pos, 0] + np.ones((len(pos), ))) / 2
     image[pos, :] /= 1.5
     image[pos, 0] = np.ones((len(pos), ))
     # image[pos, 1] = np.ones((len(pos),))
     # image[pos, 2] = np.ones((len(pos),))
     image = image.reshape(self.img_size + [3])
     if if_plot:
         viewer = ImageViewer(image)
         viewer.show()
     return image
コード例 #6
0
def test_label_painter():
    image = data.camera()
    moon = data.moon()
    viewer = ImageViewer(image)
    lp = LabelPainter()
    viewer += lp

    assert_equal(lp.radius, 5)
    lp.label = 1
    assert_equal(str(lp.label), '1')
    lp.label = 2
    assert_equal(str(lp.paint_tool.label), '2')
    assert_equal(lp.paint_tool.radius, 5)
    lp._on_new_image(moon)
    assert_equal(lp.paint_tool.shape, moon.shape)
コード例 #7
0
def test_base_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = CanvasToolBase(viewer)
    tool.set_visible(False)
    tool.set_visible(True)

    do_event(viewer, 'key_press', key='enter')

    tool.redraw()
    tool.remove()

    tool = CanvasToolBase(viewer, useblit=False)
    tool.redraw()
コード例 #8
0
ファイル: roi.py プロジェクト: zfphil/llops
def selectRoi(img, message='Select Region of Interest', roi=None):
    from skimage.viewer import ImageViewer
    from skimage.viewer.canvastools import RectangleTool
    if roi is None:
        roi = Roi()
    viewer = ImageViewer(img)
    viewer.fig.suptitle(message)
    rect = RectangleTool(viewer)
    viewer.show()
    extents = np.round(rect.extents).astype('int64')

    roi.x_start = extents[0]
    roi.x_end = extents[1]
    roi.y_start = extents[2]
    roi.y_end = extents[3]
    return roi
コード例 #9
0
def test_base_tool():
    img = data.moon()
    viewer = ImageViewer(img)

    tool = CanvasToolBase(viewer.ax)
    tool.set_visible(False)
    tool.set_visible(True)

    enter = create_mouse_event(viewer.ax, key='enter')
    tool._on_key_press(enter)

    tool.redraw()
    tool.remove()

    tool = CanvasToolBase(viewer.ax, useblit=False)
    tool.redraw()
コード例 #10
0
def show_best_match(image_id, codebook, metric):
    bows = [x[1] for x in codebook]

    if metric == 'euclidean':
        m = euclidean_distance
    elif metric == 'kullback-leibler':
        m = symmetric_kullback_leibler
    elif metric == 'bhattacharyya':
        m = bhattacharyya_distance
    elif metric == 'common words':
        m = common_words
    else:
        return "Error"

    best_match_path = codebook[find_best_match(image_id, bows, m)][0]

    img = imread(best_match_path)
    view = ImageViewer(img)
    view.show()
コード例 #11
0
def test_thick_line_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = ThickLineTool(viewer, maxdist=10)
    tool.end_points = get_end_points(img)

    do_event(viewer, 'scroll', button='up')
    assert_equal(tool.linewidth, 2)

    do_event(viewer, 'scroll', button='down')

    assert_equal(tool.linewidth, 1)

    do_event(viewer, 'key_press', key='+')
    assert_equal(tool.linewidth, 2)

    do_event(viewer, 'key_press', key='-')
    assert_equal(tool.linewidth, 1)
コード例 #12
0
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)
コード例 #13
0
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)
コード例 #14
0
def test_thick_line_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = ThickLineTool(viewer, maxdist=10, line_props=dict(color='red'),
                         handle_props=dict(markersize=5))
    tool.end_points = get_end_points(img)

    do_event(viewer, 'scroll', button='up')
    assert_equal(tool.linewidth, 2)

    do_event(viewer, 'scroll', button='down')

    assert_equal(tool.linewidth, 1)

    do_event(viewer, 'key_press',  key='+')
    assert_equal(tool.linewidth, 2)

    do_event(viewer, 'key_press', key='-')
    assert_equal(tool.linewidth, 1)
コード例 #15
0
ファイル: utils.py プロジェクト: mathandy/tf_examples
def show_image_sample(image_directory,
                      grid_shape,
                      extensions=['jpg'],
                      show=True,
                      output_filename=None,
                      thumbnail_size=100,
                      assert_enough_images=True):
    """Creates image of a grid of images sampled from `image_directory`."""

    if isinstance(thumbnail_size, int):
        size = (thumbnail_size, thumbnail_size)
    else:
        size = thumbnail_size

    def is_image(filename):
        return any(filename.lower().endswith(x.lower()) for x in extensions)

    image_files = [
        os.path.join(image_directory, fn) for fn in os.listdir(image_directory)
        if is_image(fn)
    ]

    assert len(grid_shape) == 2
    if assert_enough_images:
        assert grid_shape[0] * grid_shape[1] <= len(image_files)

    sample = np.random.choice(image_files, grid_shape)

    grid = []
    for i in range(grid_shape[0]):
        row = []
        for j in range(grid_shape[1]):
            row.append(resize(imread(sample[i, j]), size))
        grid.append(np.concatenate(row, axis=1))
    grid = (255 * np.concatenate(grid)).astype('uint8')

    if show:
        ImageViewer(grid).show()

    if output_filename is not None:
        imwrite(output_filename, grid)
コード例 #16
0
def main():
    imagefile = io.imread("colors.jpg")
    recolored_image = copy.deepcopy(imagefile)
    grayscale_matrix = np.array([0.2125, 0.7154, 0.0721])

    # loop through every pixel
    for pixel_row_index in range(len(imagefile)):
        for pixel_index in range(len(imagefile[pixel_row_index])):
            if (imagefile[pixel_row_index][pixel_index][0] > 165
                    and imagefile[pixel_row_index][pixel_index][1] < 150
                    and imagefile[pixel_row_index][pixel_index][2] < 150) and (
                        imagefile[pixel_row_index][pixel_index][1] <
                        imagefile[pixel_row_index][pixel_index][2] + 15):
                recolored_image[pixel_row_index][pixel_index] = imagefile[
                    pixel_row_index][pixel_index]
            else:
                recolored_image[pixel_row_index][pixel_index] = imagefile[
                    pixel_row_index][pixel_index].dot(grayscale_matrix)

    # transform rgb to hsv for hue
    color.rgb2hsv(imagefile)
    hue_original = get_hues(imagefile)
    color.rgb2hsv(recolored_image)
    hue_recolored = get_hues(recolored_image)

    #create plots
    fig, axs = plt.subplots(2)
    num_bins = 36
    n, bins, patches = axs[0].hist(hue_original,
                                   num_bins,
                                   facecolor='blue',
                                   alpha=0.5)
    n, bins, patches = axs[1].hist(hue_recolored,
                                   num_bins,
                                   facecolor='red',
                                   alpha=0.5)
    plt.show()

    #grayscale = color.rgb2gray(imagefile)
    viewer = ImageViewer(recolored_image)
    viewer.show()
コード例 #17
0
def test_line_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = LineTool(viewer, maxdist=10)
    tool.end_points = get_end_points(img)
    assert_equal(tool.end_points, np.array([[170, 256], [341, 256]]))

    # grab a handle and move it
    do_event(viewer, 'mouse_press', xdata=170, ydata=256)
    do_event(viewer, 'move', xdata=180, ydata=260)
    do_event(viewer, 'mouse_release')

    assert_equal(tool.geometry, np.array([[180, 260], [341, 256]]))

    # create a new line
    do_event(viewer, 'mouse_press', xdata=10, ydata=10)
    do_event(viewer, 'move', xdata=100, ydata=100)
    do_event(viewer, 'mouse_release')

    assert_equal(tool.geometry, np.array([[100, 100], [10, 10]]))
コード例 #18
0
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)
コード例 #19
0
def remove_object_loop(img):
    print("Remove object")

    viewer = ImageViewer(img)

    def on_enter(extens):
        coord = np.int64(extens)

        [x0, y0] = [coord[2], coord[0]]
        [x1, y1] = [coord[3], coord[1]]

        print([x0, y0], [x1, y1])

        (x, y) = (x0, y0)
        (len_x, len_y) = (x1 - x, y1 - y)

        viewer.image = remove_object(viewer.image, x0, y0, len_x, len_y)

    rect_tool = RectangleTool(viewer, on_enter=on_enter)
    viewer.show()
    return viewer.image
コード例 #20
0
def preserve_color_cielch(content, stylized, image_name):

    # extract info and convert to CIE-LCh for each image
    rgbContent = io.imread(content)
    labContent = color.lab2lch(
        color.xyz2lab(color.rgb2xyz(numpy.asarray(rgbContent))))
    labContentArray = numpy.array(labContent)
    rgbStyle = io.imread(stylized)
    labStyle = color.lab2lch(
        color.xyz2lab(color.rgb2xyz(numpy.asarray(rgbStyle))))
    labStyleArray = numpy.array(labStyle)

    # color transfer
    for i in range(len(labContentArray)):
        for j in range(len(labContentArray[0])):
            labContentArray[i][j][0] = labStyleArray[i][j][0]

    labContentArray = color.xyz2rgb(
        color.lab2xyz(color.lch2lab(labContentArray)))
    viewer = ImageViewer(labContentArray)
    viewer.show()
コード例 #21
0
def go(img):
    def preprocess(img):
        U = {}
        V = {}
        s = {}
        for i in (0, 1, 2):
            res = svd(img[..., i], full_matrices=False)
            U[i] = np.mat(res[0])
            V[i] = np.mat(res[2])
            s[i] = res[1]
        return U, V, s

    U, V, s = preprocess(img)

    def display(_, R, G, B):
        rgb = (R, G, B)
        res = np.zeros_like(img)
        for i in (0, 1, 2):
            _s = s[i].copy()
            _s[rgb[i]:] = 0
            S = np.mat(np.diag(_s))
            res[..., i] = U[i] * S * V[i]
        return res

    def display_all(_, RGB):
        return display(_, RGB, RGB, RGB)

    viewer = ImageViewer(img)
    plugin = Plugin(image_filter=display)
    plugin.name = ""
    plugin += Slider('R', 0, len(s[0]), len(s[0]), 'int')
    plugin += Slider('G', 0, len(s[0]), len(s[1]), 'int')
    plugin += Slider('B', 0, len(s[0]), len(s[2]), 'int')
    viewer += plugin
    plugin = Plugin(image_filter=display_all)
    plugin.name = ""
    plugin += Slider('RGB', 0, len(s[0]), len(s[0]), 'int')
    viewer += plugin
    viewer.show()
コード例 #22
0
def test_thick_line_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = ThickLineTool(viewer.ax, maxdist=10)
    tool.end_points = get_end_points(img)

    scroll_up = create_mouse_event(viewer.ax, button='up')
    tool.on_scroll(scroll_up)
    assert_equal(tool.linewidth, 2)

    scroll_down = create_mouse_event(viewer.ax, button='down')
    tool.on_scroll(scroll_down)
    assert_equal(tool.linewidth, 1)

    key_up = create_mouse_event(viewer.ax, key='+')
    tool.on_key_press(key_up)
    assert_equal(tool.linewidth, 2)

    key_down = create_mouse_event(viewer.ax, key='-')
    tool.on_key_press(key_down)
    assert_equal(tool.linewidth, 1)
コード例 #23
0
def main():
    filename_queue = tf.train.string_input_producer([tfrecords_filename])

    image = read_and_decode(filename_queue)

    init_op = tf.initialize_all_variables()

    with tf.Session() as sess:
        sess.run(init_op)

        coord = tf.train.Coordinator()
        threads = tf.train.start_queue_runners(coord=coord)

        for i in range(3):
            img = sess.run([image])
            img = img[0]
            print(img[0])
            viewer = ImageViewer(img)
            viewer.show()

        coord.request_stop()
        coord.join(threads)
コード例 #24
0
def get_crop(image):
    '''
    Show the original image to allow the user to crop any extraneous
    information out of the frame.

    :param image: 2D numpy array grayscale image
    :return: list of [left, right, top, bottom] values for the edges of the
             bounding box
    '''
    plt.ioff()
    print('Waiting for input, please crop the image as desired and hit enter')
    viewer = ImageViewer(image)
    rect_tool = RectangleTool(viewer, on_enter=viewer.closeEvent)
    viewer.show()

    bounds = np.array(rect_tool.extents)
    if (bounds[0] < 0 or bounds[1] > image.shape[1] or bounds[2] < 0
            or bounds[3] > image.shape[0]):
        print(f'Bounds = {bounds} and shape = {image.shape}')
        raise ValueError('Bounds outside image, make sure to select within')

    plt.ion()
    return np.array(np.round(bounds), dtype=int)
コード例 #25
0
def test_plugin():
    img = skimage.img_as_float(data.moon())
    viewer = ImageViewer(img)

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

    plugin = Plugin(image_filter=median_filter)
    viewer += plugin

    plugin += Slider('radius', 1, 5)

    assert_almost_equal(np.std(viewer.image), 12.556, 3)

    plugin.filter_image()

    assert_almost_equal(np.std(viewer.image), 12.931, 3)

    plugin.show()
    plugin.close()
    plugin.clean_up()
    img, _ = plugin.output()
    assert_equal(img, viewer.image)
コード例 #26
0
def test_line_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = LineTool(viewer.ax, maxdist=10)
    tool.end_points = get_end_points(img)
    assert_equal(tool.end_points, np.array([[170, 256], [341, 256]]))

    # grab a handle and move it
    grab = create_mouse_event(viewer.ax, xdata=170, ydata=256)
    tool.on_mouse_press(grab)
    move = create_mouse_event(viewer.ax, xdata=180, ydata=260)
    tool.on_move(move)
    tool.on_mouse_release(move)
    assert_equal(tool.geometry, np.array([[180, 260], [341, 256]]))

    # create a new line
    new = create_mouse_event(viewer.ax, xdata=10, ydata=10)
    tool.on_mouse_press(new)
    move = create_mouse_event(viewer.ax, xdata=100, ydata=100)
    tool.on_move(move)
    tool.on_mouse_release(move)
    assert_equal(tool.geometry, np.array([[100, 100], [10, 10]]))
コード例 #27
0
def test_rect_tool():
    img = data.camera()
    viewer = ImageViewer(img)

    tool = RectangleTool(viewer, maxdist=10)
    tool.extents = (100, 150, 100, 150)

    assert_equal(tool.corners, ((100, 150, 150, 100), (100, 100, 150, 150)))
    assert_equal(tool.extents, (100, 150, 100, 150))
    assert_equal(tool.edge_centers,
                 ((100, 125.0, 150, 125.0), (125.0, 100, 125.0, 150)))
    assert_equal(tool.geometry, (100, 150, 100, 150))

    # grab a corner and move it
    do_event(viewer, 'mouse_press', xdata=100, ydata=100)
    do_event(viewer, 'move', xdata=120, ydata=120)
    do_event(viewer, 'mouse_release')
    assert_equal(tool.geometry, [120, 150, 120, 150])

    # create a new line
    do_event(viewer, 'mouse_press', xdata=10, ydata=10)
    do_event(viewer, 'move', xdata=100, ydata=100)
    do_event(viewer, 'mouse_release')
    assert_equal(tool.geometry, [10, 100, 10, 100])
コード例 #28
0
ファイル: script.py プロジェクト: mangoklie/MiniProyecto
class SignalRetriever():

    fun = lambda x, y, z: np.logical_or(x, np.logical_or(y, z))
    view_func = lambda x: ImageViewer(x).show()

    @staticmethod
    def get_baseline(image_src):
        pass

    @staticmethod
    def transform_to_binary_image(image_src, corrector=35):
        #La funcion transforma la imagen a blanco y negro haciendo su mejor esfuerzo
        #por preservar las líneas de la señal del ECG.

        # Esta funcion realiza resalta los negros dado un determinado factor para
        # visualizar la senial.
        fun_corrector = lambda x: lambda y: int(
            x == y) * y * corrector // 100 + int(x != y) * y
        fun = SignalRetriever.fun

        #Lectura de la imagen y posterior ajuste de Gamma (Para que eliminar difuminadso)
        image = sexp.adjust_gamma(image_src, 1.25)

        #Datos importantes para la imagen
        try:
            image_aux = np.reshape(
                image, (image.shape[0] * image.shape[1], image.shape[2]))
        except IndexError:
            pass

        #El color que mas aparece
        color_dominance = np.sum(image_aux, 0)
        color_max = np.max(color_dominance)
        index_max = np.where(color_dominance == color_max)
        index_max = index_max[0][0]

        #Threshold para cada canal de la imagen
        rgb_t = list(
            map(lambda x: sfil.threshold_isodata(x),
                [image_aux[:, i] for i in range(3)]))
        fun_corrector = fun_corrector(rgb_t[index_max])

        #Aplicando threshold a cada canal y unificando
        image_aux = fun(image_aux[:, 0] > fun_corrector(rgb_t[0]),
                        image_aux[:, 1] > fun_corrector(rgb_t[1]),
                        image_aux[:, 2] > fun_corrector(rgb_t[2]))

        #Redimensionando la imagen.
        bn_im = np.reshape(image_aux, (image.shape[0], image.shape[1]))
        return bn_im

    @staticmethod
    def retrieve_signal(points, image_src):
        # Esta funcion toma los pixeles marcados y realiza una interpolacion con los pixeles
        # obtenido del procesamiento de la imagen
        y_standarized = (image_src.shape[0] - points[0]).astype(float)
        inter_func = interp1d(points[1], y_standarized)
        return inter_func

    @staticmethod
    def plot_digital_ecg(inter_func, points):
        #Funcion de prueba para ver como se ve la señal luego de una interpolación.
        x = np.linspace(np.min(points[1]), np.max(points[1]), 750)
        plt.plot(x, inter_func(x))
        plt.axes().set_aspect('equal', 'box')
        plt.show()

    @staticmethod
    def sample_signal(inter_func, points):
        # Guardando archivo de la señal.
        x = np.linspace(np.min(points[1]), np.max(points[1]), 750)
        x = inter_func(x)
        sdx = np.std(x)
        x -= np.mean(x)
        x /= sdx
        x = np.reshape(x, (x.shape[0], 1))
        # record = wfdb.Record(recordname='Test1',fs=300,nsig=1,siglen=750,p_signals=x,
        # filename=['test.dat'],baseline=[-1],units=['mV'],signame=['ECG'])
        # wfdb.plotrec(record,title='Test')
        return x

    def __init__(self, *args, **kwargs):
        self.images_src = args
        self.dir = kwargs.get('dir')
        exclude = kwargs.get('exclude')
        # Hay archivos para excluir ?
        if exclude:
            #exclude_files = open(exclude,'r')
            exclude_files = ['img_0.jpg', 'img_0_II_long.jpg']
            # json parse
            self.images_src = list(
                map(
                    lambda x: self.dir + '/' + x,
                    filter(
                        lambda x: x not in exclude_files or x[-6:] == 'bn.jpg',
                        self.images_src)))

    def get_multisignal_from_images(self):
        images = sio.imread_collection(self.images_src)
        i = 0
        array_signal = []
        for image in images:
            points, bn_image = SignalRetriever.transform_to_binary_image(
                image, corrector=15)
            #imsave(self.dir+'/'+'img_{0}_bn.jpg'.format(i),bn_image)
            inter_func = SignalRetriever.retrieve_signal(points, image)
            x = SignalRetriever.sample_signal(inter_func, points)
            # record = wfdb.Record(recordname='Test'+str(i),fs=300,nsig=1,siglen=750,p_signals=x,
            # filename=['test.dat'],baseline=[50],units=['mV'],signame=['ECG'],adcgain=[200],fmt=['16'],checksum=[0],
            # adcres=[16],adczero=[0],initvalue=[0],blocksize=[0], d_signals=None)
            #array_signal = np.concatenate((array_signal,SignalRetriever.sample_signal(inter_func,points)))
            array_signal.append(x)
            i += 1
        return array_signal
コード例 #29
0
from skimage import data
from skimage.viewer import ImageViewer
from skimage.viewer.plugins.measure import Measure

image = data.camera()
viewer = ImageViewer(image)
viewer += Measure()
viewer.show()
コード例 #30
0
def setup_line_profile(image, limits='image'):
    viewer = ImageViewer(skimage.img_as_float(image))
    plugin = LineProfile(limits=limits)
    viewer += plugin
    return plugin