• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python exposure.adjust_sigmoid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skimage.exposure.adjust_sigmoid函数的典型用法代码示例。如果您正苦于以下问题:Python adjust_sigmoid函数的具体用法?Python adjust_sigmoid怎么用?Python adjust_sigmoid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了adjust_sigmoid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: predict_image

    def predict_image(self, test_img):
        """
        predicts classes of input image
        :param test_img: filepath to image to predict on
        :param show: displays segmentation results
        :return: segmented result
        """
        img = np.array( rgb2gray( imread( test_img ).astype( 'float' ) ).reshape( 5, 216, 160 )[-2] ) / 256

        plist = []

        # create patches from an entire slice
        img_1 = adjust_sigmoid( img ).astype( float )
        edges_1 = adjust_sigmoid( img, inv=True ).astype( float )
        edges_2 = img_1
        edges_5_n = normalize( laplace( img_1 ) )
        edges_5_n = img_as_float( img_as_ubyte( edges_5_n ) )

        plist.append( extract_patches_2d( edges_1, (23, 23) ) )
        plist.append( extract_patches_2d( edges_2, (23, 23) ) )
        plist.append( extract_patches_2d( edges_5_n, (23, 23) ) )
        patches = np.array( zip( np.array( plist[0] ), np.array( plist[1] ), np.array( plist[2] ) ) )

        # predict classes of each pixel based on model
        full_pred = self.model.predict_classes( patches )
        fp1 = full_pred.reshape( 194, 138 )
        return fp1
开发者ID:meghamattikalli,项目名称:nn-segmentation-for-lar,代码行数:27,代码来源:edge_detector_cnn.py


示例2: run

 def run(self, img=misc.lena(), increase=True):
     img = misc.imread('/Users/Daniel/Desktop/p0.jpg')
     img_blurred = self.__blur(img)
     img = self.__divide(img, img_blurred)
     if False:
         img = exposure.adjust_sigmoid(img)
     misc.imsave('/Users/Daniel/Desktop/p1.jpg', img)
开发者ID:idf,项目名称:scanify,代码行数:7,代码来源:core.py


示例3: preproc

    def preproc(self, img, size, pixel_spacing, equalize=True, crop=True):
       """crop center and resize"""
        #    TODO: this is stupid, you could crop out the heart
        # But should test this
       if img.shape[0] < img.shape[1]:
           img = img.T
       # Standardize based on pixel spacing
       img = transform.resize(img, (int(img.shape[0]*(1.0/np.float32(pixel_spacing[0]))), int(img.shape[1]*(1.0/np.float32(pixel_spacing[1])))))
       # we crop image from center
       short_egde = min(img.shape[:2])
       yy = int((img.shape[0] - short_egde) / 2)
       xx = int((img.shape[1] - short_egde) / 2)
       if crop:
           crop_img = img[yy : yy + short_egde, xx : xx + short_egde]
       # resize to 64, 64
           resized_img = transform.resize(crop_img, (size, size))
       else:
           resized_img = img
       #resized_img = gaussian_filter(resized_img, sigma=1)
       #resized_img = median_filter(resized_img, size=(3,3))
       if equalize:
           resized_img = equalize_hist(resized_img)
           resized_img = adjust_sigmoid(resized_img)
       resized_img *= 255.

       return resized_img.astype("float32")
开发者ID:Breakend,项目名称:LeftVentricleVolumeEstimation,代码行数:26,代码来源:data_utils.py


示例4: proc_mbi

def proc_mbi(imgarray):
    # Normalize image:
    img = img_as_float(imgarray,force_copy=True)
    # Image equalization (Contrast stretching):
    p2,p98 = np.percentile(img, (2,98))
    img = exposure.rescale_intensity(img, in_range=(p2, p98), out_range=(0, 1))
    # Gamma correction:
    #img = exposure.adjust_gamma(img, 0.5)
    # Or Sigmoid correction:
    img = exposure.adjust_sigmoid(img)
    
    print "Init Morph Proc..."
    sizes = range(2,40,5)
    angles = [0,18,36,54,72,90,108,126,144,162]
    szimg = img.shape
    all_thr = np.zeros((len(sizes),szimg[0], szimg[1])).astype('float64')
    all_dmp = np.zeros((len(sizes) - 1,szimg[0], szimg[1])).astype('float64')
    
    idx = 0
    for sz in sizes:
        print sz
        builds_by_size = np.zeros(szimg).astype('float64')
        for ang in angles:
            print ang
            stel = ia870.iaseline(sz, ang)
            oprec = opening_by_reconstruction(img, stel)
            thr = np.absolute(img-oprec)
            builds_by_size += thr
        all_thr[idx,:,:] = (builds_by_size / len(angles))
        if idx>0:
            all_dmp[idx-1,:,:] = all_thr[idx,:,:] - all_thr[idx-1,:,:]
        idx += 1
    mbi = np.mean(all_dmp, axis=0)
    return mbi
开发者ID:jorgeop27,项目名称:geospatial_analysis_toolbox,代码行数:34,代码来源:mbi.py


示例5: callPeaks

def callPeaks(lane, gain=7, hamming=5, filt=0.2, order=9):
    """ Identify peaks in the lane 
    
    :Args:
        :param lane: The lane which to call peaks.
        :type lane: tapeAnalyst.gel_processing.GelLane

        :param gain: The gain value to use for increasing contrast (see
            skimage.exposure.adjust_sigmoid)
        :type gain: int

        :param hamming: The value to use Hamming convolution (see
            scipy.signal.hamming)
        :type gain: int

        :param filt: Remove all pixels whose intensity is below this value.
        :type filt: float

        :param order: The distance allowed for finding maxima (see scipy.signal.argrelmax)
        :type order: int

    """
    # Increase contrast to help with peak calling
    ladj = exposure.adjust_sigmoid(lane.lane, cutoff=0.5, gain=gain)

    # Tack the max pixel intensity for each row in then lane's gel image.
    laneDist = ladj.max(axis=1)

    # Smooth the distribution
    laneDist = signal.convolve(laneDist, signal.hamming(hamming))

    # Get the locations of the dye front and dye end. Peak calling is difficult
    # here because dyes tend to plateau. To aid peak calling, add an artificial
    # spike in dye regions. Also remove all peaks outside of the dyes
    try:
        dyeFrontPeak = int(np.ceil(np.mean([lane.dyeFrontStart, lane.dyeFrontEnd])))
        laneDist[dyeFrontPeak] = laneDist[dyeFrontPeak] + 2
        laneDist[dyeFrontPeak+1:] = 0
    except:
        logger.warn('No Dye Front - Lane {}: {}'.format(lane.index, lane.wellID))

    try:
        dyeEndPeak = int(np.ceil(np.mean([lane.dyeEndStart, lane.dyeEndEnd])))
        laneDist[dyeEndPeak] = laneDist[dyeEndPeak] + 2
        laneDist[:dyeEndPeak-1] = 0
    except:
        logger.warn('No Dye End - Lane {}: {}'.format(lane.index, lane.wellID))

    # Filter out low levels
    laneDist[laneDist < filt] = 0

    # Find local maxima
    peaks = signal.argrelmax(laneDist, order=order)[0]

    return peaks
开发者ID:PoissonJ,项目名称:tapeAnalyst,代码行数:55,代码来源:analysis.py


示例6: test_adjust_inv_sigmoid_cutoff_half

def test_adjust_inv_sigmoid_cutoff_half():
    """Verifying the output with expected results for inverse sigmoid
    correction with cutoff equal to half and gain of 10"""
    image = np.arange(0, 255, 4, np.uint8).reshape(8,8)
    expected = np.array([[253, 253, 252, 252, 251, 251, 250, 249],
        [249, 248, 247, 245, 244, 242, 240, 238],
        [235, 232, 229, 225, 220, 215, 210, 204],
        [197, 190, 182, 174, 165, 155, 146, 136],
        [126, 116, 106,  96,  87,  78,  70,  62],
        [ 55,  49,  43,  37,  33,  28,  25,  21],
        [ 18,  16,  14,  12,  10,   8,   7,   6],
        [  5,   4,   4,   3,   3,   2,   2,   1]], dtype=np.uint8)

    result = exposure.adjust_sigmoid(image, 0.5, 10, True)
    assert_array_equal(result, expected)
开发者ID:bernardndegwa,项目名称:scikit-image,代码行数:15,代码来源:test_exposure.py


示例7: test_adjust_sigmoid_cutoff_one

def test_adjust_sigmoid_cutoff_one():
    """Verifying the output with expected results for sigmoid correction
    with cutoff equal to one and gain of 5"""
    image = np.arange(0, 255, 4, np.uint8).reshape(8,8)
    expected = np.array([[  1,   1,   1,   2,   2,   2,   2,   2],
        [  3,   3,   3,   4,   4,   4,   5,   5],
        [  5,   6,   6,   7,   7,   8,   9,  10],
        [ 10,  11,  12,  13,  14,  15,  16,  18],
        [ 19,  20,  22,  24,  25,  27,  29,  32],
        [ 34,  36,  39,  41,  44,  47,  50,  54],
        [ 57,  61,  64,  68,  72,  76,  80,  85],
        [ 89,  94,  99, 104, 108, 113, 118, 123]], dtype=np.uint8)

    result = exposure.adjust_sigmoid(image, 1, 5)
    assert_array_equal(result, expected)
开发者ID:bernardndegwa,项目名称:scikit-image,代码行数:15,代码来源:test_exposure.py


示例8: test_adjust_sigmoid_cutoff_zero

def test_adjust_sigmoid_cutoff_zero():
    """Verifying the output with expected results for sigmoid correction
    with cutoff equal to zero and gain of 10"""
    image = np.arange(0, 255, 4, np.uint8).reshape(8,8)
    expected = np.array([[127, 137, 147, 156, 166, 175, 183, 191],
        [198, 205, 211, 216, 221, 225, 229, 232],
        [235, 238, 240, 242, 244, 245, 247, 248],
        [249, 250, 250, 251, 251, 252, 252, 253],
        [253, 253, 253, 253, 254, 254, 254, 254],
        [254, 254, 254, 254, 254, 254, 254, 254],
        [254, 254, 254, 254, 254, 254, 254, 254],
        [254, 254, 254, 254, 254, 254, 254, 254]], dtype=np.uint8)

    result = exposure.adjust_sigmoid(image, 0, 10)
    assert_array_equal(result, expected)
开发者ID:bernardndegwa,项目名称:scikit-image,代码行数:15,代码来源:test_exposure.py


示例9: test_adjust_sigmoid_cutoff_half

def test_adjust_sigmoid_cutoff_half():
    """Verifying the output with expected results for sigmoid correction
    with cutoff equal to half and gain of 10"""
    image = np.arange(0, 255, 4, np.uint8).reshape(8,8)
    expected = np.array([[  1,   1,   2,   2,   3,   3,   4,   5],
        [  5,   6,   7,   9,  10,  12,  14,  16],
        [ 19,  22,  25,  29,  34,  39,  44,  50],
        [ 57,  64,  72,  80,  89,  99, 108, 118],
        [128, 138, 148, 158, 167, 176, 184, 192],
        [199, 205, 211, 217, 221, 226, 229, 233],
        [236, 238, 240, 242, 244, 246, 247, 248],
        [249, 250, 250, 251, 251, 252, 252, 253]], dtype=np.uint8)

    result = exposure.adjust_sigmoid(image, 0.5, 10)
    assert_array_equal(result, expected)
开发者ID:bernardndegwa,项目名称:scikit-image,代码行数:15,代码来源:test_exposure.py


示例10: intensity_correction

def intensity_correction(img):
    mean_val = np.mean(img)
    mean_val = mean_val / 255.
    #print(mean_val)
    
    #sigmoid correction
    img2 = exp.adjust_sigmoid(img, cutoff = mean_val, gain=5)
    #draw(img2, "Sigmoid correction", 4, 3, 4, 4, 3, 5)
    
    #robust linear correction
    left, right = np.percentile(img2, (10, 90))
    img3 = exp.rescale_intensity(img2, in_range=(left, right))        
    #draw(img3, "Linear correction", 4, 3, 7, 4, 3, 8)
    
    img4 = filters.gaussian(img3, sigma=.5)    
    #draw(img4, "Gaussian filter", 4, 3, 10, 4, 3, 11)
    return img4
开发者ID:grihabor,项目名称:computer-vision,代码行数:17,代码来源:recognition.py


示例11: image_transformation

def image_transformation(X, method_type='blur', **kwargs):
    # https://www.kaggle.com/tomahim/image-manipulation-augmentation-with-skimage
    q = kwargs['percentile'] if 'percentile' in kwargs else (0.2, 99.8)
    angle = kwargs['angle'] if 'angle' in kwargs else 60
    transformation_dict = {
        'blur': normalize(ndimage.uniform_filter(X)),
        'invert': normalize(util.invert(X)),
        'rotate': rotate(X, angle=angle),
        'rescale_intensity': _rescale_intensity(X, q=q),
        'gamma_correction': exposure.adjust_gamma(X, gamma=0.4, gain=0.9),
        'log_correction': exposure.adjust_log(X),
        'sigmoid_correction': exposure.adjust_sigmoid(X),
        'horizontal_flip': X[:, ::-1],
        'vertical_flip': X[::-1, :],
        'rgb2gray': skimage.color.rgb2gray(X)
    }
    return transformation_dict[method_type]
开发者ID:ashishyadavppe,项目名称:Skater,代码行数:17,代码来源:image_ops.py


示例12: image_equalization

def image_equalization(image_file):
    '''
    in testing
    '''
    # Load an example image
    img = io.imread(image_file)
    #img = data.moon()
    #img = 'new.jpg'

    # Contrast stretching
    p2, p98 = np.percentile(img, (2, 98))
    img_rescale = exposure.rescale_intensity(img, in_range=(p2, p98))

    img_rescale = exposure.adjust_sigmoid(img_rescale, 0.5, 5)

    # Equalization
    img_eq = exposure.equalize_hist(img)

    # Adaptive Equalization
    img_adapteq = exposure.equalize_adapthist(img, clip_limit=0.03)

    '''
    cv2.imshow('image', img)
    cv2.waitKey(0)
    '''

    cv2.imshow('image', img_rescale)
    cv2.waitKey(0)

    '''
    cv2.imshow('image', img_eq)
    cv2.waitKey(0)
    cv2.imshow('image', img_adapteq)
    cv2.waitKey(0)
    '''

    cv2.imwrite('new_adj.jpg', img_rescale)
    '''
    cv2.imwrite('new_adj2.jpg', img_eq)
    cv2.imwrite('new_adj3.jpg', img_adapteq)
    '''

    return ['new_adj.jpg', 1, 2] #'new_adj2.jpg', 'new_adj3.jpg']
开发者ID:verdatestudo,项目名称:Fun-Calendar-Programs,代码行数:43,代码来源:detect_color_and_shape_bc.py


示例13: adjust_sigmoid

c.z_sun


# In[ ]:




# In[ ]:

cube.imshow(data=out)


# In[ ]:

out2 = adjust_sigmoid(out)


# In[ ]:

equal = equalize_adapthist(out2)


# In[ ]:

cube.imshow(equal)


# In[ ]:

meta = pd.read_csv('/Users/klay6683/Dropbox/DDocuments/UVIS/straws/coiss_ahires.015.list.txt',
开发者ID:gitter-badger,项目名称:pyciss,代码行数:31,代码来源:2016-01-05+Straw+images.py


示例14: range

		for k in range(0,len(image_file_list),n):
			X = []
			Y = []
			for fname in image_file_list[k:k+n]:
				label = label_dict[fname.split('.')[0]]
				
				cur_img = imread(folder+'/'+fname , as_grey=True)
				cur_img = 1 - cur_img

				# randomly add samples
				r_for_eq = random()

				if r_for_eq<0.3:
					cur_img = equalize_adapthist(cur_img,ntiles_x=5,ntiles_y=5,clip_limit=0.1)
				if 0.3<r_for_eq<0.4:
					cur_img = adjust_sigmoid(cur_img,cutoff=0.5, gain=10, inv=False)
				if 0.5<r_for_eq<0.6:
					cur_img = adjust_gamma(cur_img,gamma=0.5, gain=1)
				
				X.append([cur_img.tolist()])
				 
				
				label_vec = [0]*5
				label_vec[label] = 1
				"""
				label_vec = [0]*3
				if label == 0 or label == 1:
					label_vec[0] = 1
				elif label == 2 or label == 3 :
					label_vec[1] = 1
				else:
开发者ID:stegben,项目名称:Competitions,代码行数:31,代码来源:train_whole_g_channel.py


示例15:

cov_point_density = []
var_area_density = []
cov_area_density = []
fs_area = []
pairwise = []


image = exposure.equalize_adapthist(A)
io.imshow(image)
plt.grid(False)

# <codecell>

# Process for nuclei

binary = filter.threshold_adaptive(exposure.adjust_sigmoid(A[:, :, 0], cutoff=0.4, gain = 30), 301).astype(bool)
clean = morphology.binary_closing(binary, morphology.disk(3)).astype(bool)
clean = morphology.remove_small_objects(clean, 200)
clean = morphology.remove_small_objects( (1-clean).astype(bool), 200)

io.imshow(clean)
plt.grid(False)

# <codecell>

# Find contour of inflammatory zone

local_density = filter.gaussian_filter(clean, 61)
local_density -= local_density.min()
local_density /= local_density.max()
开发者ID:QCaudron,项目名称:Quantitative-Histology,代码行数:30,代码来源:batch.py


示例16: maximum_filter

		27)





	
	inflammation = \
	maximum_filter(
	    morphology.remove_small_objects(
	        filter.threshold_adaptive(
	            exposure.adjust_sigmoid(
		            filter.gaussian_filter(
		                exposure.equalize_adapthist(
		                    exposure.rescale_intensity(
		                        deconv[:, :, 1],
		                        out_range = (0, 1)),
		                    ntiles_y = 1),
		                    5),
		            cutoff = 0.6),
		            75, offset = -0.12),
		    250),
		29)







	# Labelled
开发者ID:QCaudron,项目名称:Quantitative-Histology,代码行数:31,代码来源:giftest.py


示例17:

offset = 1000
lengthscale = 301



image = exposure.equalize_adapthist(io.imread(files[4]))
#image = io.imread(files[4])
io.imshow(image)
plt.grid(False)

# <codecell>

#binary = np.logical_or(filter.threshold_adaptive(exposure.adjust_sigmoid(image[:, :, 0], cutoff=0.4, gain=20), lengthscale), \
#                       filter.threshold_adaptive(exposure.adjust_sigmoid(image[:, :, 2], cutoff=0.5, gain=20), lengthscale))

binary = filter.threshold_adaptive(exposure.adjust_sigmoid(image[:, :, 0], cutoff=0.4, gain = 30), 301).astype(bool)
clean = morphology.binary_closing(binary, morphology.disk(3)).astype(bool)
clean = morphology.remove_small_objects(clean, 200)
clean = morphology.remove_small_objects( (1-clean).astype(bool), 200)



io.imshow(clean)
plt.grid(False)


# <codecell>

(xdim, ydim, _) = image.shape
xdim /= 10
ydim /= 10
开发者ID:QCaudron,项目名称:Quantitative-Histology,代码行数:31,代码来源:Analysis-10.py


示例18:

# <codecell>

A = io.imread("../data/" + l[5])
io.imshow(A)

# <codecell>

#B = exposure.adjust_sigmoid(filter.gaussian_filter(A[:, :, 0], 19), cutoff=.45, gain=15)



B = exposure.adjust_sigmoid(
    filter.gaussian_filter(
        exposure.rescale_intensity(
            color.separate_stains(
                A, 
                np.linalg.inv(qstain)), 
            out_range=(0, 1))[:, :, 1], 
        29), 
    cutoff=.35, gain=20)
io.imshow(B)

# <codecell>

#b = morphology.remove_small_objects(filter.threshold_adaptive(filter.gaussian_filter(exposure.adjust_sigmoid(A[:,:,1]), 31), 501, offset=-0.05), 2000)

C = morphology.remove_small_objects(
    filter.threshold_adaptive(B, 301, offset=-0.025), 
    4000)
#io.imshow(morphology.binary_closing(np.logical_or(morphology.binary_dilation(C, morphology.disk(11)), b), morphology.disk(31)))
io.imshow(C)
开发者ID:ritamluis,项目名称:Quantitative-Histology,代码行数:31,代码来源:NumFoci.py


示例19: sigmoid_transform

def sigmoid_transform(img, cutoff=0.5):
    return exposure.adjust_sigmoid(img, cutoff)
开发者ID:TeamMacLean,项目名称:stomatadetector,代码行数:2,代码来源:stomataobjects.py


示例20: representation

# There are plenty of ways of combining the different grey-level images into a
# false-color representation (it's a bit of an art!).  This is a very simple
# pipeline, that mainly tweaks intensities, and that does nothing fancy along
# the lines of denoising, sharpening, etc.

import numpy as np
import matplotlib.pyplot as plt

from skimage import img_as_float, io, exposure

ic = io.ImageCollection('m8_050507_*.png')
ic = [img_as_float(img) for img in ic]
H, B, G, R, L = ic

H = exposure.adjust_sigmoid(H, cutoff=0.05, gain=35)
L = exposure.adjust_sigmoid(L, cutoff=0.05, gain=15)
R = exposure.adjust_gamma(R, 0.1)

# Merge R, G, B channels
out = np.dstack((H, L, R))
out = exposure.adjust_gamma(out, 2.1)

io.imsave('m8_recon.png', out)

f, ax = plt.subplots()
ax.imshow(out)
plt.show()
开发者ID:profjsb,项目名称:python-seminar,代码行数:27,代码来源:layers_solution.py



注:本文中的skimage.exposure.adjust_sigmoid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python exposure.cumulative_distribution函数代码示例发布时间:2022-05-27
下一篇:
Python exposure.adjust_gamma函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap