ocrd_cis/ocropy/ocrolib/psegutils.py
def rgbshow(r,g,b=None,gn=1,cn=0,ab=0,**kw):
    """Small function to display 2 or 3 images as RGB channels."""
    import matplotlib.pyplot as plt
    if b is None: b = np.zeros(r.shape)
    combo = np.transpose(np.array([r,g,b]),axes=[1,2,0])
    if cn:
        for i in range(3):
            combo[:,:,i] /= max(np.abs(np.amin(combo[:,:,i])),np.abs(np.amax(combo[:,:,i])))
    elif gn:
        combo /= max(np.abs(np.amin(combo)),np.abs(np.amax(combo)))
    if ab:
        combo = np.abs(combo)
    if np.amin(combo)<0:
        LOG.warning("RGB values less than zero")
    plt.imshow(np.clip(combo,0,1),**kw)
Small function to display 2 or 3 images as RGB channels.
Small function to display 2 or 3 images as RGB channels.
Small function to display 2 or 3 images as RGB channels .
def rgbshow(r,g,b=None,gn=1,cn=0,ab=0,**kw):
    import matplotlib.pyplot as plt
    if b is None: b = np.zeros(r.shape)
    combo = np.transpose(np.array([r,g,b]),axes=[1,2,0])
    if cn:
        for i in range(3):
            combo[:,:,i] /= max(np.abs(np.amin(combo[:,:,i])),np.abs(np.amax(combo[:,:,i])))
    elif gn:
        combo /= max(np.abs(np.amin(combo)),np.abs(np.amax(combo)))
    if ab:
        combo = np.abs(combo)
    if np.amin(combo)<0:
        LOG.warning("RGB values less than zero")
    plt.imshow(np.clip(combo,0,1),**kw)
def rgbshow ( r , g , b = None , gn = 1 , cn = 0 , ab = 0 , ** kw ) : import matplotlib . pyplot as plt if b is None : b = np . zeros ( r . shape ) combo = np . transpose ( np . array ( [ r , g , b ] ) , axes = [ 1 , 2 , 0 ] ) if cn : for i in range ( 3 ) : combo [ : , : , i ] /= max ( np . abs ( np . amin ( combo [ : , : , i ] ) ) , np . abs ( np . amax ( combo [ : , : , i ] ) ) ) elif gn : combo /= max ( np . abs ( np . amin ( combo ) ) , np . abs ( np . amax ( combo ) ) ) if ab : combo = np . abs ( combo ) if np . amin ( combo ) < 0 : LOG . warning ( "RGB values less than zero" ) plt . imshow ( np . clip ( combo , 0 , 1 ) , ** kw )
Small function to display 2 or 3 images as RGB channels.
Small function to display 2 or 3 images as RGB channels .
"""Small function to display 2 or 3 images as RGB channels."""
r
g
b
gn
cn
ab