@ Override protected ImageWritable doTransform ( ImageWritable image , Random random ) { if ( shuffle ) { Collections . shuffle ( imageTransforms ) ; } currentTransforms . clear ( ) ; // execute each item in the pipeline for ( Pair < ImageTransform , Double > tuple : imageTransforms ) { if ( tuple . getSecond ( ) == 1.0 || rng . nextDouble ( ) < tuple . getSecond ( ) ) { // probability of execution currentTransforms . add ( tuple . getFirst ( ) ) ; image = random != null ? tuple . getFirst ( ) . transform ( image , random ) : tuple . getFirst ( ) . transform ( image ) ; } } return image ; }
Takes an image and executes a pipeline of combined transforms .