use image mask

In [1]:
from openpiv import tools, scaling, validation, filters, preprocess

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from skimage import exposure
from skimage import img_as_float, img_as_ubyte
from scipy.ndimage import gaussian_filter, median_filter
from skimage.filters import threshold_otsu
from skimage.color import rgb2gray, rgba2rgb
from skimage import io
import os

import matplotlib
matplotlib.rcParams['figure.figsize'] = (8.0, 6.0)
In [2]:
# test_directory = os.path.split(os.path.abspath(__file__))[0]
test_directory = '../../test/'
img = rgb2gray(rgba2rgb(io.imread(os.path.join(test_directory, "moon.png"))))
img1, mask = preprocess.dynamic_masking(img_as_float(img), method="intensity")
mask_coords = preprocess.mask_coordinates(mask,1.5,3, plot=True)