Skip to content

Instantly share code, notes, and snippets.

from skimage.segmentation import active_contour
from skimage import io, color, transform, filters, util
import numpy as np
import matplotlib.pyplot as plt
image = io.imread('statue.jpg')
print('Rescaling image...')
image = transform.rescale(image, 0.05)
import numpy as np
from skimage import io, restoration
from skimage import img_as_float
from scipy import ndimage
def hysteresis_thresholding(im, high_threshold=0.5, low_threshold=0.2):
"""
Hysteresis thresholding, using two thresholds.
@emmanuelle
emmanuelle / skimage_3d_compatibility.py
Last active April 16, 2019 08:10
Inspect which functions of scikit-image are compatible with 3-D arrays.
import numpy as np
import inspect
from skimage import exposure, feature, filters, measure, morphology, \
restoration, segmentation, transform, util
def only_one_nondefault(args):
"""
Returns True if the function has only one non-keyword parameter,
False otherwise.
@emmanuelle
emmanuelle / chunk.py
Created April 10, 2018 14:50
Apply function in parallel to overlapping chunks of an array, for example for image processing
import numpy as np
from sklearn.externals.joblib import Parallel, delayed
def apply_parallel(func, data, *args, chunk=100, overlap=10, n_jobs=4,
**kwargs):
"""
Apply a function in parallel to overlapping chunks of an array.
joblib is used for parallel processing.
@emmanuelle
emmanuelle / benchmark_skimage_cv2.py
Created May 31, 2018 22:59 — forked from Jathrone/benchmark_skimage_cv2.py
Compares runtimes for several functions common to opencv and scikit-image
import numpy as np
import inspect
from skimage import exposure, feature, filters, measure, morphology, \
restoration, segmentation, transform, util, data, color
from timeit import default_timer
import pandas as pd
import cv2
import time
###this python script returns a csv of function runtimes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import numpy as np
from skimage import data
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import numpy as np
from skimage import data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
import plotly.express as px
gapminder = px.data.gapminder().query("year == 2007").reset_index()
app = dash.Dash(__name__)