本文整理汇总了Python中skimage.filters.rank.minimum函数的典型用法代码示例。如果您正苦于以下问题:Python minimum函数的具体用法?Python minimum怎么用?Python minimum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了minimum函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_empty_selem
def test_empty_selem():
# check that min, max and mean returns zeros if structuring element is
# empty
image = np.zeros((5, 5), dtype=np.uint16)
out = np.zeros_like(image)
mask = np.ones_like(image, dtype=np.uint8)
res = np.zeros_like(image)
image[2, 2] = 255
image[2, 3] = 128
image[1, 2] = 16
elem = np.array([[0, 0, 0], [0, 0, 0]], dtype=np.uint8)
rank.mean(image=image, selem=elem, out=out, mask=mask,
shift_x=0, shift_y=0)
assert_equal(res, out)
rank.geometric_mean(image=image, selem=elem, out=out, mask=mask,
shift_x=0, shift_y=0)
assert_equal(res, out)
rank.minimum(image=image, selem=elem, out=out, mask=mask,
shift_x=0, shift_y=0)
assert_equal(res, out)
rank.maximum(image=image, selem=elem, out=out, mask=mask,
shift_x=0, shift_y=0)
assert_equal(res, out)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:26,代码来源:test_rank.py
示例2: test_compare_with_grey_erosion
def test_compare_with_grey_erosion():
# compare the result of maximum filter with erode
image = (np.random.rand(100, 100) * 256).astype(np.uint8)
out = np.empty_like(image)
mask = np.ones(image.shape, dtype=np.uint8)
for r in range(3, 20, 2):
elem = np.ones((r, r), dtype=np.uint8)
rank.minimum(image=image, selem=elem, out=out, mask=mask)
cm = grey.erosion(image=image, selem=elem)
assert_equal(out, cm)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:12,代码来源:test_rank.py
示例3: test_percentile_min
def test_percentile_min():
# check that percentile p0 = 0 is identical to local min
img = data.camera()
img16 = img.astype(np.uint16)
selem = disk(15)
# check for 8bit
img_p0 = rank.percentile(img, selem=selem, p0=0)
img_min = rank.minimum(img, selem=selem)
assert_equal(img_p0, img_min)
# check for 16bit
img_p0 = rank.percentile(img16, selem=selem, p0=0)
img_min = rank.minimum(img16, selem=selem)
assert_equal(img_p0, img_min)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:13,代码来源:test_rank.py
示例4: test_smallest_selem16
def test_smallest_selem16():
# check that min, max and mean returns identity if structuring element
# contains only central pixel
image = np.zeros((5, 5), dtype=np.uint16)
out = np.zeros_like(image)
mask = np.ones_like(image, dtype=np.uint8)
image[2, 2] = 255
image[2, 3] = 128
image[1, 2] = 16
elem = np.array([[1]], dtype=np.uint8)
rank.mean(image=image, selem=elem, out=out, mask=mask, shift_x=0, shift_y=0)
assert_equal(image, out)
rank.minimum(image=image, selem=elem, out=out, mask=mask, shift_x=0, shift_y=0)
assert_equal(image, out)
rank.maximum(image=image, selem=elem, out=out, mask=mask, shift_x=0, shift_y=0)
assert_equal(image, out)
开发者ID:YangChuan80,项目名称:scikit-image,代码行数:18,代码来源:test_rank.py
示例5: test_16bit
def test_16bit():
image = np.zeros((21, 21), dtype=np.uint16)
selem = np.ones((3, 3), dtype=np.uint8)
for bitdepth in range(17):
value = 2 ** bitdepth - 1
image[10, 10] = value
assert rank.minimum(image, selem)[10, 10] == 0
assert rank.maximum(image, selem)[10, 10] == value
assert rank.mean(image, selem)[10, 10] == int(value / selem.size)
开发者ID:borevitzlab,项目名称:scikit-image,代码行数:10,代码来源:test_rank.py
示例6: test_16bit
def test_16bit():
image = np.zeros((21, 21), dtype=np.uint16)
selem = np.ones((3, 3), dtype=np.uint8)
for bitdepth in range(17):
value = 2 ** bitdepth - 1
image[10, 10] = value
if bitdepth > 11:
expected = ['Bitdepth of %s' % (bitdepth - 1)]
else:
expected = []
with expected_warnings(expected):
assert rank.minimum(image, selem)[10, 10] == 0
assert rank.maximum(image, selem)[10, 10] == value
assert rank.mean(image, selem)[10, 10] == int(value / selem.size)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:15,代码来源:test_rank.py
示例7: check_all
def check_all():
np.random.seed(0)
image = np.random.rand(25, 25)
selem = morphology.disk(1)
refs = np.load(os.path.join(skimage.data_dir, "rank_filter_tests.npz"))
assert_equal(refs["autolevel"], rank.autolevel(image, selem))
assert_equal(refs["autolevel_percentile"], rank.autolevel_percentile(image, selem))
assert_equal(refs["bottomhat"], rank.bottomhat(image, selem))
assert_equal(refs["equalize"], rank.equalize(image, selem))
assert_equal(refs["gradient"], rank.gradient(image, selem))
assert_equal(refs["gradient_percentile"], rank.gradient_percentile(image, selem))
assert_equal(refs["maximum"], rank.maximum(image, selem))
assert_equal(refs["mean"], rank.mean(image, selem))
assert_equal(refs["mean_percentile"], rank.mean_percentile(image, selem))
assert_equal(refs["mean_bilateral"], rank.mean_bilateral(image, selem))
assert_equal(refs["subtract_mean"], rank.subtract_mean(image, selem))
assert_equal(refs["subtract_mean_percentile"], rank.subtract_mean_percentile(image, selem))
assert_equal(refs["median"], rank.median(image, selem))
assert_equal(refs["minimum"], rank.minimum(image, selem))
assert_equal(refs["modal"], rank.modal(image, selem))
assert_equal(refs["enhance_contrast"], rank.enhance_contrast(image, selem))
assert_equal(refs["enhance_contrast_percentile"], rank.enhance_contrast_percentile(image, selem))
assert_equal(refs["pop"], rank.pop(image, selem))
assert_equal(refs["pop_percentile"], rank.pop_percentile(image, selem))
assert_equal(refs["pop_bilateral"], rank.pop_bilateral(image, selem))
assert_equal(refs["sum"], rank.sum(image, selem))
assert_equal(refs["sum_bilateral"], rank.sum_bilateral(image, selem))
assert_equal(refs["sum_percentile"], rank.sum_percentile(image, selem))
assert_equal(refs["threshold"], rank.threshold(image, selem))
assert_equal(refs["threshold_percentile"], rank.threshold_percentile(image, selem))
assert_equal(refs["tophat"], rank.tophat(image, selem))
assert_equal(refs["noise_filter"], rank.noise_filter(image, selem))
assert_equal(refs["entropy"], rank.entropy(image, selem))
assert_equal(refs["otsu"], rank.otsu(image, selem))
assert_equal(refs["percentile"], rank.percentile(image, selem))
assert_equal(refs["windowed_histogram"], rank.windowed_histogram(image, selem))
开发者ID:YangChuan80,项目名称:scikit-image,代码行数:37,代码来源:test_rank.py
示例8: filters
# Local maximum and local minimum are the base operators for gray-level
# morphology.
#
# .. note::
#
# `skimage.dilate` and `skimage.erode` are equivalent filters (see below
# for comparison).
#
# Here is an example of the classical morphological gray-level filters:
# opening, closing and morphological gradient.
from skimage.filters.rank import maximum, minimum, gradient
noisy_image = img_as_ubyte(data.camera())
closing = maximum(minimum(noisy_image, disk(5)), disk(5))
opening = minimum(maximum(noisy_image, disk(5)), disk(5))
grad = gradient(noisy_image, disk(5))
# display results
fig, ax = plt.subplots(2, 2, figsize=[10, 7], sharex=True, sharey=True)
ax1, ax2, ax3, ax4 = ax.ravel()
ax1.imshow(noisy_image, cmap=plt.cm.gray)
ax1.set_title('Original')
ax2.imshow(closing, cmap=plt.cm.gray)
ax2.set_title('Gray-level closing')
ax3.imshow(opening, cmap=plt.cm.gray)
ax3.set_title('Gray-level opening')
开发者ID:adarsh006,项目名称:scikit-image,代码行数:31,代码来源:plot_rank_filters.py
示例9: TestSample
def TestSample(self): # Run pump, take samples and analyse
global currentPhoto
self.im1Count["text"] = "-" # Reset text fields
self.im2Count["text"] = "-"
self.im3Count["text"] = "-"
self.im1Average["text"] = "-"
self.im2Average["text"] = "-"
self.im3Average["text"] = "-"
self.imFinalCount["text"] = "-"
self.imFinalAverage["text"] = "-"
self.sizeAct["text"] = "-"
self.Confidence["text"] = "-"
self.ConfDisp["bg"] = "grey"
##'''
global camera
camera.stop_preview() # Quit preview if open
########################### Run pump and take Pictures ###############################
self.pump_On() # Turn on pump
self.update_idletasks() # Refresh Gui
for x in range(0, 25): # Wait 25 seconds
self.labelCurrentAction["text"] = "Pumping Liquid - %d" % (25 - x)
self.update_idletasks()
time.sleep(1)
self.pump_Off() # Turn off pump
for x in range(1, 4): # Take 3 images
self.pump_Off()
self.labelCurrentAction["text"] = "Powder Settle Time"
self.update_idletasks()
time.sleep(2)
self.labelCurrentAction["text"] = "Capturing Image %d" % x
camera.hflip = True # Flip camera orientation appropriately
camera.vflip = True
camera.capture("/home/pi/PythonTempFolder/OrigPic" + str(x) + ".jpg") # Save image to default directory
self.update_idletasks()
time.sleep(2)
if x < 3:
self.pump_On() # Turn on pump
for y in range(0, 6): # Wait 6 seconds
self.labelCurrentAction["text"] = "Pumping Liquid - %d" % (6 - y)
self.update_idletasks()
time.sleep(1)
self.pump_Off() # Turn off pump
##'''
################################################################################################
########################### Analyse Pictures ###############################
for x in range(1, 4):
self.labelCurrentAction["text"] = "Loading image as greyscale - im %d" % x
self.update_idletasks()
image1 = io.imread(
"/home/pi/PythonTempFolder/OrigPic" + str(x) + ".jpg", as_grey=True
) # Load image as greyscale
##
##image1 = io.imread('/home/pi/SDP Project/PowderTests/PPIM169041/169041Pic' + str(x) + '.jpg', as_grey=True) ##Comment Out
##
self.labelCurrentAction["text"] = "Cropping" # Crop image
self.update_idletasks()
fromFile = np.asarray(image1, dtype=np.float32)
orig = fromFile[0:1080, 420:1500]
currentPhoto = orig
self.showCurrent()
self.update_idletasks()
time.sleep(2)
self.labelCurrentAction["text"] = "Applying minimum filter" # Apply minimum filter
self.update_idletasks()
image2 = minimum(orig, disk(6))
currentPhoto = image2
self.t.destroy()
self.update_idletasks()
self.showCurrent()
self.update_idletasks()
self.labelCurrentAction["text"] = "Applying mean filter" # Apply mean filter
self.update_idletasks()
image3 = mean(image2, disk(22))
currentPhoto = image3
self.t.destroy()
self.update_idletasks()
self.showCurrent()
self.update_idletasks()
self.labelCurrentAction["text"] = "Applying maximum filter" # Apply maximum filter
self.update_idletasks()
image4 = maximum(image3, disk(6))
currentPhoto = image4
self.t.destroy()
#.........这里部分代码省略.........
开发者ID:Jacquesvv,项目名称:Rpi-Powder-Rig-Control,代码行数:101,代码来源:HWControlv5+Final.py
注:本文中的skimage.filters.rank.minimum函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论