Python pylab.gray() Examples

The following are 5 code examples of pylab.gray(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pylab , or try the search function .
Example #1
Source File: fusion_dwb.py    From ImageFusion with MIT License 5 votes vote down vote up
def plot(self):
        plt.figure(0)
        plt.gray()
        plt.subplot(131)
        plt.imshow(self._images[0])
        plt.subplot(132)
        plt.imshow(self._images[1])
        plt.subplot(133)
        plt.imshow(self._fusionImage)
        plt.show() 
Example #2
Source File: fusion_pca.py    From ImageFusion with MIT License 5 votes vote down vote up
def plot(self):
        plt.figure(0)
        plt.gray()
        plt.subplot(131)
        plt.imshow(self._images[0])
        plt.subplot(132)
        plt.imshow(self._images[1])
        plt.subplot(133)
        plt.imshow(self._fusionImage)
        plt.show() 
Example #3
Source File: ocrd_anybaseocr_binarize.py    From ocrd_anybaseocr with Apache License 2.0 5 votes vote down vote up
def dshow(self, image, info):
        if self.parameter['debug'] <= 0:
            return
        ion()
        gray()
        imshow(image)
        ginput(1, self.parameter['debug']) 
Example #4
Source File: paramgraphics.py    From nips14-ssl with MIT License 5 votes vote down vote up
def imgshow(plt, w, dim_input, scale=False, colorImg=False, convertImgs=False, tile_spacing=(1,1)):
    if convertImgs:
        channelSize = w.shape[0]/3
        w = tuple([w[channelSize*i:channelSize*(i+1)] for i in range(3)])
    plt.axis('Off')
    pil_image = mat_to_img(w, dim_input, scale, colorImg, tile_spacing)
    plt.imshow(pil_image, cmap=pylab.gray(), origin='upper')
    return pil_image 
Example #5
Source File: process_merlin_label.py    From ophelia with Apache License 2.0 4 votes vote down vote up
def main_work():

    #################################################
      
    # ============= Process command line ============

    a = ArgumentParser()

    a.add_argument('-b', dest='binlabdir', required=True)   
    a.add_argument('-t', dest='text_lab_dir', required=True)    
    a.add_argument('-n', dest='norm_info_fname', required=True)  
    a.add_argument('-o', dest='outdir', required=True) 
    a.add_argument('-binext', dest='binext', required=False, default='lab')    
    a.add_argument('-skipterminals', action='store_true', default=False)    


    opts = a.parse_args()
    
    # ===============================================

    safe_makedir(opts.outdir)

    norm_info = get_speech(opts.norm_info_fname, 425)[:,:-9]
    data_min = norm_info[0,:]
    data_max = norm_info[1,:]
    data_range = data_max - data_min

    text_label_files = set([basename(f) for f in glob.glob(opts.text_lab_dir + '/*.lab')])
    binary_label_files = sorted(glob.glob(opts.binlabdir + '/*.' + opts.binext) )
    print binary_label_files
    for binlab in binary_label_files:
        base = basename(binlab)
        if base not in text_label_files:
            continue
        print base
        lab = process_merlin_label(binlab, opts.text_lab_dir)
        if opts.skipterminals:
            lab = lab[1:-1,:] ## NB: dont remove 2 last as in durations, as the final punct does't features here
        norm_lab = minmax_norm(lab, data_min, data_max)

        if 0: ## piano roll style plot:
            pl.imshow(norm_lab, interpolation='nearest')
            pl.gray()
            pl.savefig('/afs/inf.ed.ac.uk/user/o/owatts/temp/fig.pdf')
            sys.exit('abckdubv')

        np.save(opts.outdir + '/' + base, norm_lab)