package pl.wroc.pwr.imagechannel.basic; import pl.wroc.pwr.IOperator; import pl.wroc.pwr.imagechannel.IImageChannel; import pl.wroc.pwr.imagechannel.model.ImageChannel; public class MinimumChannel implements IOperator< IImageChannel > { private IImageChannel channel1; private IImageChannel channel2; public MinimumChannel( IImageChannel channel1, IImageChannel channel2 ) { this.channel1 = channel1; this.channel2 = channel2; } public IImageChannel apply( ) { IImageChannel result = new ImageChannel( this.channel1.getSize( ) ); for ( int i = 0; i < this.channel1.getMaxIndex( ); i++ ) { result.setValue( i, Math.min( this.channel1.getValue( i ), this.channel2.getValue( i ) ) ); } return result; } }