本文整理汇总了Python中skimage.exposure.equalize_adapthist方法的典型用法代码示例。如果您正苦于以下问题:Python exposure.equalize_adapthist方法的具体用法?Python exposure.equalize_adapthist怎么用?Python exposure.equalize_adapthist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skimage.exposure
的用法示例。
在下文中一共展示了exposure.equalize_adapthist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readScan
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def readScan(scanNum, dirName):
""" Reads a DICOM file from a directory
Given a directory name and the number of the file containing the image to be read, reads in and returns a numpy representation of the image. Also normalizes the pixel values of the image.
Args:
scanNum: An integer containing the one-based index of the file to be read
dirName: A string representation of the name of the directory to be opened. This directory should be a child of the working directory. Ex: "trainingImages"
Returns:
A numpy array containing the pixel data for the image
"""
for root, dir, files in os.walk("./" + dirName):
scans = [file for file in files if file != "desktop.ini"]
print("Reading image " + scans[scanNum] + " from " + dirName)
data = numpy.load("./" + dirName + "/" + scans[scanNum])
#plt.imshow(data)
#plt.show()
data = exposure.equalize_adapthist(data)
#plt.imshow(data)
#plt.show()
return data
print(dirName + " is not a valid directory")
exit(-1)
示例2: apply_clahe
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def apply_clahe(img):
img = img / 255.
img = exposure.equalize_adapthist(img)
img = img * 255.
return img
# == AUGMENTATION == #
示例3: normReadAll
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def normReadAll():
""" Reads all images in the training set
Reads all images from the training set. Assumes that the working directory has subdirectories "PosTrain" and "NegTrain"
Returns:
A numpy array containing the pixel values for the batch of images. Also returns a numpy array containing whether each image has a positive or negative label
"""
labels = []
patientData = []
posLen = imageCount("PosTrain")
negLen = imageCount("NegTrain")
for i in range(posLen):
data = readScan(i, "PosTrain")
labels.append(1)
data = exposure.equalize_adapthist(data)
patientData.append(data)
for i in range(negLen):
data = readScan(i, "NegTrain")
labels.append(0)
data = exposure.equalize_adapthist(data)
patientData.append(data)
patientData = numpy.stack(patientData).astype(float)
return patientData, numpy.stack(labels)
示例4: readTest
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def readTest():
""" Reads all images in the test set
Reads all images from the test set. Assumes that the working directory has subdirectories "PosTest" and "NegTest"
Returns:
A numpy array containing the pixel values for the batch of images. Also returns a numpy array containing whether each image has a positive or negative label
"""
labels = []
patientData = []
posLen = imageCount("PosTest")
negLen = imageCount("NegTest")
for i in range(posLen):
data = readScan(i, "PosTest")
labels.append(1)
data = exposure.equalize_adapthist(data)
patientData.append(data)
for i in range(negLen):
data = readScan(i, "NegTest")
labels.append(0)
data = exposure.equalize_adapthist(data)
patientData.append(data)
patientData = numpy.stack(patientData).astype(float)
return patientData, numpy.stack(labels)
示例5: crop_and_resize_test
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def crop_and_resize_test(image, contrast = False):
img_crop = np.zeros([image_size[0], image_size[1], 3], dtype = np.float)
img_roi = image[-image_size[0]:, :, :]
if contrast:
img_adapteq = exposure.equalize_adapthist(img_roi, clip_limit=0.01)
else:
img_adapteq = img_roi / 255.0
img_adapteq = img_adapteq * 255.0
img_crop[:, 72:(72+3384), :] = img_adapteq
return img_crop
开发者ID:wwoody827,项目名称:cvpr-2018-autonomous-driving-autopilot-solution,代码行数:12,代码来源:predict-checkpoint.py
示例6: adaptive_equalize
# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def adaptive_equalize(img):
# Adaptive Equalization
img = img_as_float(img)
img_adapteq = exposure.equalize_adapthist(img, clip_limit=0.05)
return img_as_ubyte(img_adapteq)