machinevisiontoolbox.Image.Ramp
- classmethod Image.Ramp(size=256, cycles=2, dir='x', dtype='float32')
- Create image of linear ramps - Parameters:
- dir (str, optional) – ramp direction: ‘x’ [default] or ‘y’ 
- size (int, optional) – image width and height, defaults to 256 
- cycles (int, optional) – Number of complete ramps, defaults to 2 
- dtype (str, optional) – NumPy datatype, defaults to ‘float32’ 
 
- Returns:
- intensity ramps 
- Return type:
- Image
 - The ramps span the range: - float image: 0 to 1 
- int image: 0 to maximum positive value of the integer type 
 - Example: - >>> from machinevisiontoolbox import Image >>> Image.Ramp(10, 2).image array([[0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ], [0. , 0.25, 0.5 , 0.75, 1. , 0. , 0.25, 0.5 , 0.75, 1. ]], dtype=float32) >>> Image.Ramp(10, 3, dtype='uint8').image array([[ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254], [ 0, 109, 218, 71, 72, 182, 35, 36, 145, 254]], dtype=uint8)